wp_query Select & sort by multiple custom fields
-
I have multiple post types that all have same two custom fields : featured and fixed, booth Boolean.
I’m trying to get all the post that have the featured enabled and sort them so all the ones that have fixed true will be first in the query.this is what i have so far. it works for selecting the featured ones, but i can’t get the sorting part to work.
$args = array(
‘post_type’=>array(‘panels’, ‘guests’, ‘amtv’),
‘meta_query’ => array(
array (‘key’ => ‘featured’,
‘value’ => 1,
‘compare’ => ‘=’,
‘type’ => ‘CHAR’
),
array (‘key’ => ‘fixed’
‘order’ => ‘ASC’,
‘orderby’ => ‘value’
)
)
);
query_posts($args);Any help would be appreciated :)
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
-
Your question is about a self-hosted WordPress blog and we cannot help your here at WordPress.com. you’ll find help at the WordPress.org forums. http://wordpress.org/support/
-
-
- The topic ‘wp_query Select & sort by multiple custom fields’ is closed to new replies.