search post on custom fied
I am new with both word press and cctm which is great and save me a lot of work. Thanks a lot for building this plug in !
I have a custom type called Item which has a price.
Now I wanted to search Post depending on some cutom field. For instance on the “Price” field and I would like to search for every post which price is higher or lower than a posted value.
if I do that :
$Q = new GetPostsQuery();
$args = array();
$args[‘post_type’] = ‘item’;
$args[‘orderby’] = ‘post_title’;
$args[‘price’] = ’10’;
$results = $Q->get_posts($args)
it will return items where price equals 10.
Could you point me out a link or a quick sample code, how to achieve that. If I could avoid writting sql it would be good, if it is not possible I ll deal with it.
- The topic ‘search post on custom fied’ is closed to new replies.