WP_Query sort by custom filed
-
Hi guys,
I want to retrieve the posts into the loop and arrange / filter them by priority. I want the posts marked ‘featured’ to have a higher priority while the rest of the posts can come right below that. I am using the following code.
$loop = new WP_Query( array( 'post_type' => 'company_listing', 'cat' => get_query_var('cat'), //'meta_key' => 'featured', //'orderby' => 'yes' ) );
When ever I comment out the meta_key and the orderby (which is a radio button) it only returns the featured posts and none of the ordinary posts. I also do not wish to return redundadt posts
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WP_Query sort by custom filed’ is closed to new replies.