I would like to know if there's a way to do a query filtered by a custom field result. In this case, I have 6 posts I would like to retrieve, but only if they have "true" selected in a custom field I've previously created. The name of the custom field is called "featured".
Here's my code
<?php
$recentPosts = new WP_Query();
$recentPosts->query('showposts=6');
?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<li>
<?php if ( has_post_thumbnail() ) {?>
<div class="post-thumb-140">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'post-thumb-140' ); ?></a>
</div> <!--post-thumb-->
<?php } ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
I've checked WordPress documentation on possible WP_Query arguments, but there are no filters based on a custom field.
Any ideas?