Support » Fixing WordPress » Problem with single_cat_title after 3.0 upgrade, NOT resolved.

  • Resolved DarkLaw



    I have just upgraded to version 3.0, and single_cat_title seems to have stopped working in my array, the category title won’t display anymore.

    There is a [resolved] post a bit further down from this one, but it is NO help. He resolved it himself with very little details and I’m having the same problem! The original poster had said he got around the problem by using get_cat_name instead, but I’m confused and that doesn’t do anything but cause other problems within my code. We are both apparently using the same theme because our code is the exact same.

    And if you couldn’t tell, I’m still pretty fresh to php.

    Help!? 😀 Thanks!

    // enter the IDs of which categories you want to display
    $display_categories = array(3,24,7,12,174,15,41,9,8,11,25,16,72);
    foreach ($display_categories as $category) {
    $count = 0; // Set the post counter ?>
        <div class="clearfloat">
          <?php query_posts("showposts=4&cat=$category"); // Set showposts to 4 - 1 with excerpt and 3 without
    	    $wp_query->is_category = false;
    		$wp_query->is_archive = false;
    		$wp_query->is_home = true;
          <h3><a href="<?php echo get_category_link($category);?>">
    	// name of each category gets printed
    	  single_cat_title(); ?>
Viewing 12 replies - 1 through 12 (of 12 total)
  • There’s some sloppy coding in there. Try changing:



    query_posts('posts_per_page=4&cat=' . $category);

    Thanks for the cleanup advice…

    but that still doesn’t address my category titles. Any advice on that?

    Here’s the actual page –

    In the center-area column, it should denote the category name in <h3 above each group of articles… however, with the 3.0 upgrade, they vanished.


    Kevin Hayden

    hay que cambiar

    of $wp_query->is_category = false; to $wp_query->is_category = true;


    of <?php single_cat_title();?> to <?php printf( __(‘%s’,”), single_cat_title(”, false)); ?>

    asi queda

    <?php $display_categories = array(5);
    foreach ($display_categories as $category) { ?>
    <?php query_posts(‘posts_per_page=4&cat=’ . $category);
    $wp_query->is_category = true;
    $wp_query->is_archive = false;
    $wp_query->is_home = true;

    <div class=”postheader_right”><h2>“><?php printf( __(‘%s’,”), single_cat_title(”, false)); ?></h2></div>

    Thank you, that worked!


    Having the same problem with this code…

    <h3 class="catt-<?php echo $cp_pC; ?>"><a href="<?php echo get_category_link( $cp_pC ); ?>"><?php single_cat_title() ?> &raquo;</a></h3>

    Thank you, frankbs. I had the same problem and I could fix it with that modification. ;


    Muchas gracias, frankbs. También tenía el mismo problema y con esa modificación lo pude solucionar. 😉

    DarkLaw, frankbs, and all

    I had the same problem.

    That fixed it —
    DarkLaw, frankbs y todos los

    Tuve el mismo problema.

    Eso es fijo. Gracias

    Thank You! I had the same issue and it got resolved by your Method.

    Thank you frankbs, it worked for me too 🙂

    frankbs thank you it works but why do this happend?

    I know this post is over 4 months old, but there are still some templates out there that are non-functioning because of one little line.

    The problem arises from the file wp-includes/general-template.php where the function single_cat_title has been updated to include another requirement:

    if ( !is_category() )

    So if the template doesn’t specifically tell the query it is a category, it will silently fail.

    In most cases simply calling $wp_query->is_category = true; BEFORE the function is called then the function will work as properly. If not, printf that was mentioned above will definitely force it to work because it won’t “echo”/”display” the title.

    Hello. I used Brandford Magazine Theme for my webpage, and i have some problem with the “browse Category” on the right sidebar.

    The webpage is:

    As you can see the Browse Category List is empty.

    Can you help me to resolve the problem?

    Thank you from Italy


Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Problem with single_cat_title after 3.0 upgrade, NOT resolved.’ is closed to new replies.