Support » Themes and Templates » [Resolved] Determining Current Category ID

[Resolved] Determining Current Category ID

  • Hi. When you display posts by category, how do you find out what the post category is? In other words, how do you determine the number that’s after “cat”? Is there a particular function call I could use? I’m trying to add information that depends on the category ID in a sidebar. Thanks!

    ex// http://some.domain.com/index.php?cat=55

Viewing 3 replies - 1 through 3 (of 3 total)
  • When a category is created it is given an ID which is visible from the Manage -> Categories menu. You can create categories there or create them from a post.

    Hope that helps.

    Nex, thanks for the reply. Unfortunately, that’s not quite what I meant.

    To clarify, I’m trying to display custom category descriptions for the category pages (that appear when you click on a particular category) by changing my sidebar.php. To do this, I need to know the ID of the current category, the one that the user clicked. The function I’ve been trying to use, get_the_category(), returns all the categories to which a certain category belongs, which doesn’t help me.

    Is there any way for me to get that number?

    Resolved by a friend in a hackish sort of way: steal the number directly from the top using something like $cat_ID = $_GET[‘cat’];

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Determining Current Category ID’ is closed to new replies.