• Hey Gang,

    I’ve had this problem for awhile now and haven’t had the know how to sort through the code and find the problem. I first noticed this when posting blog post links on facebook and through the tweetmeme button. Only the blog title would appear. My blog’s title is on every single post and page in my blog. How do I make it so it shows the the blog post title in the title bar? I’m also assuming this is where facebook and the tweetme button pulls the blog post title from?

    Information:

    Blog: https://www.alexxhenry.com/blog

    Theme: Benevolence

    Header.php code:

    <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head>
    <title><?php bloginfo('name'); ?></title>
    
    	<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />
    	<style type="text/css" media="screen">
    		@import url( <?php bloginfo('stylesheet_url'); ?> );
    	</style>
    
    	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
        	<?php wp_get_archives('type=monthly&format=link'); ?>
    	<?php //comments_popup_script(); // off by default ?>
    	<?php wp_head(); ?>
    
    </head>
    
    <body>
    
    <div id="wrapper">
    
    	<div id="masthead">
    
    <div id="ahplink">
    <a title="alexx henry photography" href="https://alexxhenry.com/">alexx henry photography</a>
    	</div>
    	</div>
    
    	<div id="insideWrapper">
Viewing 9 replies - 1 through 9 (of 9 total)
  • Change this:
    <title><?php bloginfo('name'); ?></title>

    to something better……here’s what I use

    <title><?php if (function_exists('is_tag') && is_tag()) { echo 'Tag Archive for &quot;'.$tag.'&quot; - '; } elseif (is_archive()) { wp_title(''); echo ' Archive - '; } elseif (is_search()) { echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; } elseif (!(is_404()) && (is_single()) || (is_page())) { wp_title(''); echo ' - '; } elseif (is_404()) { echo 'Not Found - '; } if (is_home()) { bloginfo('name'); echo ' - '; bloginfo('description'); } else { bloginfo('name'); } ?></title>
    Thread Starter gantproductions

    (@gantproductions)

    Hey RVoodoo,

    I tried your code and it fixed the problem. However, I now have the title showing twice on the main page and on the blog post it correctly displays the blog post title but then also displays my abnormally long blog title as well resulting in a GIANT browser/link title.

    Also, as a test, I deleted your code entirely, and left just <title> (forgive me im no CSS master) and it still shows exactly the same thing, so I don’t think your code was doing anything, but I could be wrong. Any suggestions?

    Here is the updated header.php:

    <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head>
    <title>
    
    	<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />
    	<style type="text/css" media="screen">
    		@import url( <?php bloginfo('stylesheet_url'); ?> );
    	</style>
    
    	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
        	<?php wp_get_archives('type=monthly&format=link'); ?>
    	<?php //comments_popup_script(); // off by default ?>
    	<?php wp_head(); ?>
    
    </head>
    
    <body>
    
    <div id="wrapper">
    
    	<div id="masthead">
    
    <div id="ahplink">
    <a title="alexx henry photography" href="https://alexxhenry.com/">alexx henry photography</a>
    	</div>
    	</div>
    
    	<div id="insideWrapper">

    (forgive me im no CSS master)

    that’s fine….this file isn’t css! ??

    don’t leave an open tag in your head! close <title> with </title> or things will go screwy!

    I can guarantee my code did something, as long as you replaced your code with mine….didn’t add it

    The code I gave works perfectly for me….. you can tweak it to your needs… here’s where I got the info
    https://perishablepress.com/press/2008/07/21/how-to-generate-perfect-wordpress-title-tags-without-a-plugin/

    Thread Starter gantproductions

    (@gantproductions)

    Okay let me rephrase, I’m no master in any code ??

    RVoodoo: I put your code back in. Still having double blog titles on main page.

    For everyone still reading this thread I’ve even simplified the problem by making my header.php <title> code this:

    <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

    Even if I simplify it to <title></title> I still get double blog titles in the title bar. So it looks like the problem isn’t in the <title> area, am I wrong?

    try this

    `
    <title>
    <?php if(is_home()): bloginfo(‘name’); else: wp_title(); endif; ?>

    </title>

    Thread Starter gantproductions

    (@gantproductions)

    try this

    `
    <title>
    <?php if(is_home()): bloginfo(‘name’); else: wp_title(); endif; ?>

    </title>

    Negative chinmoy. Still double titles on the front page. I feel like the problem lies elsewhere then <title></title> but I could definitely be wrong ??

    You try this?? definitely it will work. I ma write this code in my blog.

    <title><?php
    if (is_home()) {
    	bloginfo('name');
    } elseif (is_404()) {
    	echo '404 Not Found'; echo ' | '; bloginfo('name');
    } elseif (is_category()) {
    	echo 'Category:'; wp_title(); echo ' | '; bloginfo('name');
    } elseif (is_search()) {
    	echo 'Search Results'; echo ' | '; bloginfo('name');
    } elseif ( is_day() || is_month() || is_year() ) {
    	echo 'Archives:'; wp_title(); echo ' | '; bloginfo('name');
    } else {
    	echo wp_title(); echo ' | '; bloginfo('name');
    }
    ?></title>

    ??

    Thread Starter gantproductions

    (@gantproductions)

    Chinmoy! It works! Thank you!

    One more thing though, before the blog post title now it shows a >> before the title. How do I remove this?

    you will see &raquo; or >> inside the <title></title> tag. remove this. If you can’t see this code, give me the code only for <title></title>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Blog post title not appearing in browser title bar’ is closed to new replies.