Support » Fixing WordPress » 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?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trying to order by a custom field’ is closed to new replies.