[wp-trac] Re: [WordPress Trac] #7431: Allow posts to be ordered by
meta_key
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 31 16:12:10 GMT 2008
#7431: Allow posts to be ordered by meta_key
-------------------------------------+--------------------------------------
Reporter: AaronCampbell | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 2.7
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+--------------------------------------
Comment (by AaronCampbell):
I think it would be nice to also allow not only a meta_value to be
specified, but a meta_compare ('=', '>', '>=', '<', or '<=') that would
let the user get posts where the meta_value is greater than ____. It
would be used like this:
{{{
$args = array(
'meta_key' => 'wpo_feedid',
'orderby' => 'wpo_feedid',
'meta_value' => '2',
'meta_compare' => '<'
);
$myQuery = new WP_Query($args);
}}}
My patch doesn't currently allow for ranges (> ? AND < ?), but it works
pretty well to allow just a single choice. It also depends on this patch,
so I was wondering if I should start a new ticket, or modify this one.
I'm adding 7431.002.diff as a patch that includes this (it's inclusive of
the 001 patch, so only 002 is needed). If it should be in another ticket,
just let me know.
--
Ticket URL: <http://trac.wordpress.org/ticket/7431#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list