I have a simple WP_Query loop, where I output posts by category. My problem is that I want to change the order of posts, for example:
Post ID’s: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Post ID’s: 8, 6, 3, 1, 2, 4, 5, 7, 9, 10
So I took three posts, shifted them to the top and left others untouched. In general, what I would like to do, is to get an array of post ID’s that corresponds to the current category, alter it and submit (to WP_Query?) before while have_posts() the_post() loop.
I’ve searched this forum quite a while and the only thing I came up with was action hook pre_get_posts, but I guess it’s wrong, because as I understood, this event is called before the query is submitted to the DB.
Any suggestions/solutions to this problem?
- The topic ‘WP_Query. Change posts order’ is closed to new replies.