WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sorting combined list of posts from multiple categories (4 posts)

  1. csbecker
    Member
    Posted 3 years ago #

    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

  2. esmi
    Forum Moderator
    Posted 3 years ago #

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

  3. csbecker
    Member
    Posted 3 years ago #

    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!

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Glad you got it sorted. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic