I am using the below to successfully output a list.
I have added a new field (true/false) to check if a list item returns true or false.
How can i modify the code below to check if something returns ‘false’ and prevent it from showing in my list if it does? The true/false field name is ‘artist_link_homepage’.
<?php
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'artist',
'meta_key' => 'artist_location',
'meta_value' => 'new york',
'orderby' => 'title',
'order' => 'ASC'
));
if($posts)
{
echo '<ul class="artists">';
foreach($posts as $post)
{
echo '<li><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></li>';
}
echo '</ul>';
}
?>
The the section on multiple custom field hadnling https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters. You need to adjust your meta query to include the new field.