Support » Plugins » Get the category from the query

  • Hi,
    I’m using query_posts() to filter a certain category out of the index page and monthly archives (to be used as ‘asides’)
    In the index page, i just use query_posts(), but in the monthly archives, I need to get the archive month from the query, and pass it to wp_query() so it will show the right category.
    How do I do this?
    I hope this makes sense…

Viewing 1 replies (of 1 total)
  • If you’re using default permalinks on your blog (i.e. ?p=10), you can collect the global $m variable and pass that to query_posts:

    <?php query_posts("m=$m"); ?>

    For custom permalinking, try $year and $monthnum:

    <?php query_posts("year=$year&$monthnum=$monthnum"); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Get the category from the query’ is closed to new replies.