Jump to content

Recommended Posts

Hi,

I've changed the heck out of my blog header.php file and now I'm stuck. For the blog titles, it currently displays this:

 

homepage title: ~ BLOG_NAME

individual post page title: POST_NAME ~ BLOG_NAME

 

On the individual page titles, I only want the POST_NAME, and not the blog title too. Can you suggest what to change?

 

Thanks!

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } ?> ~ <?php bloginfo('name'); ?></title>
    
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/custom.css" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

    <?php wp_head(); ?>
</head>
<body class="custom">

<div id="container">

    <div id="masthead">
        <h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
        <h3><?php bloginfo('description'); ?></h3>
    </div>

    <ul id="nav">
        <li <?php if (is_home()) echo('class="current_page_item" '); ?>><a href="<?php bloginfo('url'); ?>">front page</a></li>
        <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
        
        
    </ul>
    
    <div id="header_img">
        <img src="<?php bloginfo('template_url'); ?>/images/my-header.jpg" width="770px" height="140px" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?> " />
         
</div>

Link to comment
https://forums.phpfreaks.com/topic/171074-help-with-blog-headerphp-file-change/
Share on other sites

I'm not sure in the page exactly but Wordpress uses a template system.. the functions such as:

bloginfo('url'); 
bloginfo('name'); 
bloginfo('description'); 

Are basically what echo on the page the name of your site, the post name, and desc etc. So find where you're wanting to remove blog_name, and remove..... bloginfo('name') or similar, whatever wordpress defined to call its name.

hi oni-kun,

Thanks for the suggestion. The problem is that I want the blog name to be the home page title and the blog post name to be the post page title. If I delete the blog name, then the home page title will be blank (I already did that by accident).

So again, if it's the home page, I want the title to be the blog name, and if its a post page, I want the title to be only the name of the post...

I got the solution. I changed the title to this:

 

<title><?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { echo bloginfo('name'); } ?></title>

 

Now the blog title displays just the blog name and the post title displays just the post names (and not the blog titles too).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.