Вывод статей из дочерней рубрики
Здравствуйте!
Возник вопрос. Необходимо под записью вывести слайдер с анонсами статей из той же рубрики, что и текущая статья. Сложность в том что рубрика дочерняя. Сейчас делаю так
<div class="resentpst" id="owl-example"> <?php $getcat = get_the_category(); $cat = $getcat[0]->cat_ID; $recent = new WP_Query('cat='); while($recent->have_posts()) : $recent->the_post(); ?> <div class="onerespost"> <a href="<?php the_permalink(); ?>"> <h3> <?php $get_the_title = get_the_title(); $get_the_title = wp_trim_words( $get_the_title, 4, '...' ); echo $get_the_title; ?> <span>по теме</span></h3> </a> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(); ?> </a> <div class="onerespostxt"><a href="<?php the_permalink(); ?>"> <?php $kom_article = get_post_meta($post->ID, 'anons_article', true); ?> <?php //kama_excerpt(); ?></a></div> </div> <?php endwhile; ?> </div>