On my post page I am trying to display list of other posts from the same category of the original post. So far I got this and this does not seem to work:
<?php
$args = array(
'post_type' => 'article',
'posts_per_page' => 5,
'post__not_in' => array( get_the_ID() ),
'category' => array( get_the_category() ),
'meta_query' => array(
array(
'key' => 'recommended_article',
'value' => '1',
'compare' => '=='
)
)
);
$query = new WP_Query( $args );
?>
<?php if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
<a class="popup-article-picture" href="<?php the_permalink(); ?>" style="background-image: url('<?php the_post_thumbnail_url(); ?>');"></a>
<a class="popup-article-title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile; endif; wp_reset_postdata(); ?>
category
attached to your custom post type? Are there any articles in the same category with meta valuerecommended_article == 1
? When you say it doesn't work, what are you expecting to see and how do you judge that it's not working as it should?article
?