• I have my site set up to display all categories BUT cat 2. (<%php $cat = “-2”; ?>) BUT it shows the title in the title bar…. IMHO it shouldn’t be doing this. I think I could modify single_cat_title to deal with it in my case, but someone else may want to look at it for a more permanent fix.
    TG

Viewing 3 replies - 1 through 3 (of 3 total)
  • Did you change something? It looks like it is fixed. What happened to your cat=3?

    Thread Starter TechGnome

    (@techgnome)

    Hehe…. don’t have any thing posted in it. Maybe I’ll get to it tonight, hopefully. How did I fix it? In index.php, right after I set my $cat=-2; I set a flag that I check for later…. Let me dig out the code…..
    Right after $blog=1; I have the following….
    $show_cat = true;
    if (empty($HTTP_POST_VARS['cat'])) {
    if (empty($HTTP_GET_VARS['cat'])) {
    $cat=-2;
    $show_cat = false;
    }
    }

    $show_cate = true is the default, that will determine if the category name gets displayed or not.
    The next IF statements check to see if cat was passed in on the querystring (if the cat was clicked on) if it IS NOT found, then I set $cat = -2 and set $show_cat = false.
    Then my <title> tag looks like this:
    <title><?php bloginfo('name') ?><?php single_post_title(' :: ') ?><?php if (!$show_cat)
    {
    echo "";
    }else{
    single_cat_title(' :: ');
    } ?><?php single_month_title(' :: ') ?></title>

    If $show_cat is false, then I don’t print a cat title. if it is true, then the tile get the cat name.
    Simple, really. I know why the flaw happens. Some where in one of the many includes of blog.header.php and links.php, the $cat is turned into its absolute value. So, by the time single_cat_title() is called, $cat is 2 and returns the category name for cat 2, even though it’s on the front page, where everything BUT cat 2 is displayed.
    TG

    eeek. that sounds like a bug that needs fixing, if the ‘negative category numbering’ thing is supposed to ‘do the right thing in all cases’.
    I was just about to look into doing something like that… maybe I’ll go back to rolling my own sub-categories instead. 😉
    =d

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cat title showing when it shouldn’t’ is closed to new replies.