add landing
This commit is contained in:
48
rfo/category-end.php
Normal file
48
rfo/category-end.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Category Block Template
|
||||
*
|
||||
* @param array $args {
|
||||
* @type string $category Slug рубрики (по умолчанию 'rfo')
|
||||
* @type string $title Заголовок блока (по умолчанию 'Интервью')
|
||||
* @type int $posts_count Количество постов (по умолчанию 1)
|
||||
* }
|
||||
*/
|
||||
|
||||
// Извлекаем параметры
|
||||
$category = isset($args['category']) ? $args['category'] : 'rfo';
|
||||
$title = isset($args['title']) ? $args['title'] : 'РФО';
|
||||
$style = isset($args['style']) ? $args['style'] : 0;
|
||||
$posts_count = isset($args['posts_count']) ? $args['posts_count'] : 1;
|
||||
?>
|
||||
|
||||
<div class="custom-category-block" data-category="<?php echo esc_attr($category); ?>">
|
||||
<?php
|
||||
$query_args = array(
|
||||
'category_name' => $category,
|
||||
'posts_per_page' => $posts_count,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC'
|
||||
);
|
||||
|
||||
$query = new WP_Query($query_args);
|
||||
|
||||
if ($query->have_posts()) : ?>
|
||||
|
||||
<div class="article-item-wrapper__rfo">
|
||||
<div class="land-cart-title">
|
||||
<div class="land-cart-title__text"><?php echo esc_html($title); ?></div>
|
||||
<div class="land-cart-title__arrow"></div>
|
||||
</div>
|
||||
|
||||
<div class="article-item-rfo">
|
||||
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
||||
<?get_template_part( 'content', 'post-rfo', [ 'class'=>'article-item-rfo '.$style ] );?>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif;
|
||||
|
||||
wp_reset_postdata(); ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user