So I have modified my title for my Wordpress Blog. The current setup should change the category to reflect the title of the page that I want. However my home page title is blank. Every other page title seems to work fine. Here is what is in my header.php file for my theme I am using: <title><?php if ( is_category() ) { ?> Windows Vista <?php wp_title(''); ?> <?php } else { ?><?php wp_title(''); ?> <?php }?></title> Code (markup): It used to work, but after some recent upgrades it no longer seem to show. It just pulls a blank title. site: http://themes4vista.com Code (markup): Any ideas why? I am drawing a blank.
The code looks fine. Do you have any seo plugins that might need you to set the home title individiually?
I don't have any seo plugins at all. Not sure why it would do that. The home page is an actual page. Could I just modify the code in the title to add an extra "else if" statement that if its that page display X title? If so how would I do that? The above code is code I hacked together from another site. Im only just above beginner in PHP. Thanks for your time.
<title><?php echo ( is_category() ? 'Windows Vista ' : ''), wp_title('', false, ''); ?></title> PHP: I'm pretty sure that will work. I shortened it a little and rewrite wp_title with the proper parameters. Hope it works!
Does the page actually load the header anywhere? I think WP lets you override the themes with your own pages, so that might be the problem
Try this. I used to have problems when using php inside titles for some reason, so I would just echo everything. Works the same. <?php if (is_category()){ echo "<title>Windows Vista "; wp_title(); echo "</title>"; } else { echo "<title>"; wp_title(); echo "</title>"; } ?>
Yeilded the same result as the existing code. Everything works but the home page. Weird. Thanks for cleaning it up though. Yes, I tested just putting actual text in and it loads. Yielded the same result as existing code. Thanks for all the suggestions guys. At a loss. Any more thoughts welcome.
Try this instead <?php if (is_category()){ echo "<title>Windows Vista "; wp_title(); echo "</title>"; } elseif (is_home()) { echo "<title>"; wp_title(); echo "</title>"; } else { echo "<title>"; wp_title(); echo "</title>"; } ?>
I really can't see echoing title tags being an issue to be honest. It must be something set in WP that is causing the blank title. What version are you using?
I would have thought that would work, I manually added my title to the else if in your code, but it still didn't show. Which makes me think that it isn't recognizing the is_home() or something. Wierd cause if I just put plain text it works fine. I agree, I don't see how echoing the title tags would make a difference. But I am willing to try anything. You do bring up an interesting point. I have Version 2.9. It has worked in previous versions. But it has been a long time since I have messed with the title and several versions of wordpress. Its just not something I ususally check to see if its there.