WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting the category before "the loop" (2 posts)

  1. joedan
    Member
    Posted 8 years ago #

    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.

  2. joedan
    Member
    Posted 8 years ago #

    NEVERMIND... I found

    http://codex.wordpress.org/Alphabetizing_Posts

    which for some reason I could not find earlier this evening.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags