[wp-hackers] Problem with custom title tags

Nathan Rice ncrice at gmail.com
Wed Feb 18 20:28:56 GMT 2009


Some of this is just a guess, but I'll take a stab at it below


On Wed, Feb 18, 2009 at 2:32 PM, Kim Parsell <kparsell-wp at kpdesign.net>wrote:
>
>
> <?php if (is_front_page()) { ?><?php bloginfo('name'); ?> - <?php echo
> bloginfo ('description'); } ?>
> This returns <title>Blog Name - Service, Support, Solutions Blog Name
> </title>. The blog name is being repeated after the description (is this a
> bug or intended behavior?).


I'm not sure if this is correct, but if you have a page defined as your
"front page" it's possible that both is_front_page and is_page are both
returning true.


>
>
> The other one I am having problems with is:
>
> <?php if (is_single()) { ?><?php bloginfo('name'); ?> | <?php
> single_cat_title(); ?>: <?php the_title(); } ?>
>
> This code returns <title>Blog Name | : Who We Are</title> - note that the
> Category title (single_cat_title) is missing.
>
>
Like Jennifer said, single_cat_title only returns a value if you are viewing
a category archive (IOW, if the "cat" query var is set).

While you're doing this work, take a look at the wp_title function in the
trunk source code.  You'll find that it does much of this stuff for you
already, and what it doesn't do, you can actually filter it to make it do
what you want it to.
http://svn.automattic.com/wordpress/trunk/wp-includes/general-template.php

Nathan


More information about the wp-hackers mailing list