Hey gang,
I'm trying to make a custom query of related posts by category, which works fine, but I'd also like to only include posts that have a post image (featured image) set. My query is pasted below, can anyone see what I'm doing wrong?
// get other (random) posts from this category only as related posts //
$backup = $post; // backup the current object
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args = array (
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
showposts'=>10, // Number of related posts that will be shown.
'orderby'=>'rand',
'caller_get_posts'=>1,
'post_image'=>true
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();