• I have this:

    echo single_cat_title(''); wp_title(''); echo ' - some more keywords';

    Category name is not showing in title tag, everything else does.
    How should this line look like?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter balkanguy

    (@balkanguy)

    This code displays category name outside of the loop, but don’t know how to make it work inside title tag

    <?php
    foreach((get_the_category()) as $category) {
        echo $category->cat_name . ' ';
    }
    ?>

    Thread Starter balkanguy

    (@balkanguy)

    Anyone?

    gmisen

    (@gmisen)

    did you ever figure this out? i’m having the same problem

    Give this a shot….

    <title><?
    
    if(is_front_page())
    	{ echo get_bloginfo('name') . ' &raquo; ' . get_bloginfo('description'); }
    else	{
    	wp_title('&laquo;',true,'right');
    
    	if(is_single())
    		{
    		$category = get_the_category();
    		echo $category[0]->cat_name . ' &laquo;';
    		}
    
    	echo ' ' .  get_bloginfo('name');
    	}
    
    ?></title>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to print category name in title tag?’ is closed to new replies.