WordPress.org

Support

Support » How-To and Troubleshooting » Maintain the post order according to category name in WP_Query?

Maintain the post order according to category name in WP_Query?

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

    @esmi

    Forum Moderator

    No. All available orderby options are listed in this Codex section. what is it that you are trying to do? List posts according to categories – ie Cat 1 posts followed by Cat 2 posts etc?

    Yes exactly. I want to order posts by category something like this
    cat1
    post1
    post2
    post3
    cat2
    post1
    post2
    post3


    Is it possible by using simple wp_query() or i have to get the categories then loop through the category id. But in this case i have another issue with pagination.

    esmi

    @esmi

    Forum Moderator

    You’ll need to use the second option – grab the categories and then step through them launching a new query & Loop for each category. And, yes, I can see how that’s going to create a pagination issue but I don’t think there’s any other way of doing this.

    Thanks for your support esmi.

    I have the same problem but I have got the posts by category. Still facing issue for paging.

    🙁

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Maintain the post order according to category name in WP_Query?’ is closed to new replies.