WordPress.org

Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #16329


Ignore:
Timestamp:
01/21/11 14:28:21 (3 years ago)
Author:
scribu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16329 – Description

    initial v2  
    11I 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. 
    22 
    3 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.  
     3I 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.  
    44 
    5 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.  
     5This 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.  
    66 
    7 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.  
     7It 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.