Sorting query_posts posts by the order of id's given in post__in
|Reported by:||danielpataki||Owned by:|
Description (last modified by scribu)
I am trying to build a search highly customized for a website. The two things I would like to do is to make posts which have the term in their title show up first, and I am also trying to make it play nice with query_posts.
I wrote two queries, one gets all the post ID's which have the term in the post title, and the other gets the post ID's which do NOT have the term in their title, but have it in the contents. I then merge these arrays. I use the resulting array of id's in the post__in parameter of query_posts.
This does result in the correct set of posts being returned, but I am unable to order them in the order the post ids are in the post__in clause. This would be important, since the array of post ids is in the correct order, but query_posts rearranges the results. I have tried using "none" as the orderby, but to no avail, it just sorts the posts by ID.
It would be nice if there was an option to sort by post__in, meaning that the order of the posts returned corresponds to the order of the posts in the post__in clause.