WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] current category id? (3 posts)

  1. lutzer
    Member
    Posted 8 years ago #

    Does any variable exist which contains the ID of the currently selected category to use in my theme? If the user is viewing a post the variable should contain the ID of the category which the current post belongs to. When the user is viewing a category archive the variable should of course contain the current category ID.

  2. Chris_K
    Member
    Posted 8 years ago #

    The answer to your question is yes. What's your end goal?

    Some links:
    http://codex.wordpress.org/Template_Tags#Category_tags (likely you'll see one of these in action in your current theme)

    http://codex.wordpress.org/Category_Templates

  3. lutzer
    Member
    Posted 8 years ago #

    Ok, got it: $cat

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags