The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Assigning post category to $cat on single.php (1 post)

  1. adHominem
    Posted 11 years ago #

    Well, I installed 1.5 and it's been fantastic. I have a question, though. I'd like to have single.php display different headers/sidebars depending on the category of the post displayed thereon. I've broken those bits out into different pages, which display the content depending on the value of $cat, which works nicely for category queries, of course, but not individual posts, since $cat isn't set. But it should be relatively simple to get that info and assign it to $cat, shouldn't it? I've got this code at the top of single.php right now:

    if (!isset($_GET[cat])) { $cat = the_category(); }

    Which plainly does not work. I've gone through the fora & the codex, but I don't get it. Should I be using single_cat_title instead, or something altogether else?

    Thank you in advance, any potential saviours.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.