Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. if (in_array($wp_query->query_vars['meta_key'], array("pa_pph","pa_tonnage","pa_capacity","pa_horsepower","pa_zones","pa_screw_diameter"))) {
  2.         $wp_query->query_vars['orderby'] = "meta_value_num";
  3.  
  4.  
  5.     // this is what breaks the sorting... BUT I get all the posts that I need.
  6.     // if I remove this, then I only get posts with the meta data
  7.         $wp_query->query_vars['meta_query'][] = array('key'=>$wp_query->query_vars['meta_key'],'compare'=>'NOT EXISTS');
  8.         $wp_query->query_vars['meta_query']['relation'] = "OR";
  9.  
  10.  
  11.     $wp_query->get_posts();
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement