Support » Themes and Templates » Getting the category before “the loop”

  • Resolved joedan


    On the archive template I want to sort the posts differently depending on what category they are in.

    For example if the URL is:
    I want to add this
    <?php $posts = query_posts($query_string . '&orderby=' . 'title' . '&order=' . 'asc' . '&posts_per_page=-1'); ?> before the loop.

    All the template tags that seem to identify the category (such as “the_category” and “get_the_category”) all have to be used with in the loop. Setting the sorting order has to be done before the loop.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Getting the category before “the loop”’ is closed to new replies.