<?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();
}
?>
а как это включить в код вывода новых статей, и комментарий выводить 1 последний и укороченный по словам?
Сайт allremont59.ru