shkola/wp-content/themes/dekart/template-parts/block-read-also.php

35 lines
866 B
PHP

<?php
$post_id = get_the_ID();
?>
<div class="read-block">
<h2 class="read-block_title">Читать также<h2>
<div class="read-blocks-wrapper">
<?php
$cat_1_ID = 74;
$cat_2_ID = 84;
$args = array(
'posts_per_page' => 3,
'post_type' => 'post',
'category' => [$cat_1_ID, $cat_2_ID],
'orderby' => 'date',
'order' => 'DESC',
'post__not_in' => [ $post_id ],
);
$query = new WP_Query($args); ?>
<?php
while ($query->have_posts()) {
$query->the_post(); ?>
<article class="block-new">
<a href="<?php the_permalink(); ?>">
<div class="block-new_img">
<?php if ( has_post_thumbnail()) { ?>
<?php the_post_thumbnail(); ?>
<?php } ?>
</div>
<h3 class="block-new_title"><?php the_title(); ?></h3>
</a>
</article>
<?php } wp_reset_postdata(); ?>
</div>
</div>