Trying to order by a custom field
I have a custom field called “rank_points”, currently a post either has a value of 40 or 1. I would like all of the posts with a value of 40 to show up in first by title alphabetically, then the posts with a value of 1 to show up by title and alphabetically.
I have the following before the loop:
$temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query>query('cat=20,-282&orderby=title&order=ASC'.'&paged='.$paged);
Within my query can I insert ‘meta_value=rank_points&order_by=rank_points’?
Or do I have to query the meta values and then order by the results?
- The topic ‘Trying to order by a custom field’ is closed to new replies.