List posts when custom field is specific value
-
Any help would be greatly appreciated as I’ve been trying to figure this out for a few hours.
Basically, I’m trying to output a list of titles from of a specific post type based on whenever the “Style & Art” select box has been chosen within those posts.
The below code doesn’t seem to output anything other than the opening and closing ul tags.
However, if I remove the meta_query array then it lists all post types.
<ul> <?php $args = array( 'post_type' => 'profiles', 'meta_query' => array( array( 'key' => 'you_may_also_like', 'value' => 'Style & Art' ) ) ); query_posts($args); while ( have_posts() ) : the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; wp_reset_query(); ?> </ul>
I need to be able to filter them based on a certain criteria but not having any luck at the moment.
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘List posts when custom field is specific value’ is closed to new replies.