41 lines
1.5 KiB
PHP
41 lines
1.5 KiB
PHP
<section class="popular-subjects news">
|
|
<div class="container">
|
|
<h2 class="page_h2">Наши новости</h2>
|
|
<?php // параметры по умолчанию
|
|
$posts = get_posts( array(
|
|
'numberposts' => 3,
|
|
'category' => 0,
|
|
'orderby' => 'date',
|
|
'order' => 'DESC',
|
|
'include' => array(),
|
|
'exclude' => array(),
|
|
'meta_key' => '',
|
|
'meta_value' => '',
|
|
'post_type' => 'post',
|
|
'suppress_filters' => true,
|
|
) ); ?>
|
|
<div class="swiper swiper-news">
|
|
<div class="swiper-wrapper">
|
|
<?php foreach( $posts as $post ){ setup_postdata($post); ?>
|
|
<a href="<?php the_permalink(); ?>" class="swiper-slide popular__subject">
|
|
<div class="popular__subject_img">
|
|
<span class="popular__subject_label"><?php echo get_the_date( 'd.m.Y' ); ?></span>
|
|
<?php if ( has_post_thumbnail()) { ?>
|
|
<?php the_post_thumbnail(); ?>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="product-info">
|
|
<h3 class="popular__subject_title"><?php the_title(); ?></h3>
|
|
<p class="popular__subject_text"><?php echo wp_trim_words( get_the_excerpt(), 25 ); // post excerpt; ?></p>
|
|
</div>
|
|
</a>
|
|
<?php } wp_reset_postdata(); ?>
|
|
</div>
|
|
</div>
|
|
<div class="custom-button-next news-next"></div>
|
|
<div class="custom-button-prev news-prev"></div>
|
|
<div class="buttons">
|
|
<a href="/novosti/" class="btn-yellow-link">все новости</a>
|
|
</div>
|
|
</div>
|
|
</section>
|