Support » Fixing WordPress » getting category?

  • I’m modifying my header file to display description and keywords meta tags and I’m wondering when viewing a category page, how do I get that category?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Look at the wp-content/themes/default/archive.php file (lines 8 and 9) for an example of how it ‘detects’ the Category. It uses the is_category conditional tag.

    Other resources:
    Conditional_Tags

    Thread Starter pdstein

    (@pdstein)

    Michael thanks for your help. To clarify, I’m aware of the is_category() function, but I don’t know how to get or display the category if a category archive page is being displayed. How do I do that?

    Thanks!

    Thread Starter pdstein

    (@pdstein)

    Nevermind. I figured it out. single_cat_title()

    The example at
    http://codex.wordpress.org/Template_Tags/single_cat_title
    implied that it returned the category title along with HTML linking to the category. I didn’t want the HTML, and now I found it doesn’t include it. Problem solved.

    Yeah that single_cat_title is what the default theme uses. Thanks for the feedback and please consider marking this topic resolved.

    Or please consider spelling out to us newbies exactly what you did.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘getting category?’ is closed to new replies.