Forums

[resolved] Get Category Name (2 posts)

  1. kovhert
    Member
    Posted 1 year ago #

    Hi folks,
    I'm using code from here to display a list of recent posts from a specific Category in my Sidebar.

    But I would like to display posts from whichever category the user happens to be in *right now*.

    There's a line in the code:
    query_posts('category_name=services&showposts=10')

    Basically, how can I make it display the CURRENT category instead of the hard-coded "services"?

  2. kovhert
    Member
    Posted 1 year ago #

    Okay so I figured it out based on the original Loop I'm using to actually display posts.
    I changed the line to say:
    query_posts('category_name='.get_the_title().'&showposts=10')
    And it works fine now for whatever category I'm in.

Topic Closed

This topic has been closed to new replies.

About this Topic