<?php
$query_args = array( // Полная документация здесь (wp-kama.ru/function/wp_query)
'posts_per_page' => 15, // Количество анонсов
)
?>
<?php $query = new WP_Query( $query_args ); ?>
<?php if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php get_template_part ('content-list');?>
<?php endwhile; endif; ?>
<?php
$categories = get_the_category($post->ID);
if ($categories) {
echo '<div class="commenth4">Читайте так же:</div>';
$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'=>8,'orderby'=>'rand','ignore_sticky_posts'=>1);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<div class="post-sidebar bottom">
<?php the_post_thumbnail('medium'); ?>
<a class="title" itemprop="headline" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
</div>
<?php
}
}
wp_reset_query();
}
?>