Нужно узнать
ID текущей категории поста и поставить его в массив параметров нужных постов. Потом
стандартным циклом выводить посты.
<ul> <?php $category = get_the_category(); $cat_add_id = $category[0]->term_id; $real_id = get_the_ID(); $args = array( 'cat' => $cat_add_id, 'numberposts' => 6 ); $query = new WP_Query( $args ); if( $query->have_posts() ){ while( $query->have_posts() ){ $query->the_post(); if ($post->ID != $real_id) { ?> <li> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a> </li> <?php } } wp_reset_postdata(); } ?></ul>