Quantcast
Channel: Question and Answer » meta-query
Viewing all articles
Browse latest Browse all 36

Show list users based on two custom field values

$
0
0

I’m kinda stuc. I have added an extra field in the user profile for my authors, called ArtistCategory which can be Tattoo or Piercing. I’m using this key and value to filter for menu and gallery options. All works great. But now I need to order in this selection by last name and it keeps showing all users or order based on ID. This is my code and appreciate some help to get this fixed.

$blogusers = get_users_of_blog(); 
if ($blogusers) {
foreach ($blogusers as $bloguser) { 
$args = array( 
'author' => $bloguser->user_id, 
'showposts' => 1,
'tag' => 'Tattoo', 
'caller_get_posts' => 1,
'cat' => array(6),
'orderby' => 'last_name',
'order'   => ASC
); 
$my_query = new WP_Query($args); 
if( $my_query->have_posts() ) { 
while ($my_query->have_posts()) : $my_query->the_post(); ?>  
<?php $author = get_the_author(); ?>
<div>
Do Stuff
</div>
<?php endwhile; 
} 
} 
} 

Added orderby and order to try if it worked. Also tried multiple query args meta_query but that gave me all users… I think I’m missing something here :)


Viewing all articles
Browse latest Browse all 36

Trending Articles