WordPress.org

Support

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

[Resolved] Getting the category before “the loop”

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

    For example if the URL is:
    http://www.example.com/wordpress/?cat=3
    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 ‘[Resolved] Getting the category before “the loop”’ is closed to new replies.