Support » Fixing WordPress » Sorting combined list of posts from multiple categories

  • Resolved csbecker

    (@csbecker)


    I have been able to get a list of posts from 2 categories.

    <?php query_posts('cat=33,32&order=ASC&posts_per_page=-1');

    But the result shows posts from the first category and then the second category. But I would rather have them combined first and then sorted. Does anyone know what query I would do to get this?

    Thanks! Chris

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try adding in an orderby parameter – eg: <?php query_posts('cat=33,32&orderby=date&order=ASC&posts_per_page=-1');

    Thanks Esmi. Orderby did it, but I had to do it with title. My final code is:
    <?php query_posts('cat=32,33&orderby=title&order=ASC&posts_per_page=-1');

    Thanks again!

    esmi

    (@esmi)

    Forum Moderator

    Glad you got it sorted. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sorting combined list of posts from multiple categories’ is closed to new replies.