wp_get_post_categories( get_the_ID() ),
'posts_per_page' => $count,
'post__not_in' => array( get_the_ID() )
) );
$related = new WP_Query( $args );
if ( $related->have_posts() ) {
?>
have_posts() ) {
$related->the_post();
if ( get_the_post_thumbnail()=='')
{
$background_img_relatedpost = get_template_directory_uri()."/img/default.jpg";
$post_thumbnail= '
';
}
else
{
//$post_thumbnail = get_the_post_thumbnail( get_the_ID(), 'img-responsive blog-img' );
$post_thumbnail = get_the_post_thumbnail( get_the_ID(),'atoz_related_posts', ['class' => 'img-responsive blog-img', 'title' => 'Feature image']);
}
$title=get_the_title();
global $post;
$categories = get_the_category($post->ID);
$cat_link = get_category_link($categories[0]->cat_ID);
printf('
',
get_the_date(),
$post_thumbnail,
$title,
$cat_link,
esc_url( get_permalink() )
);
?>