update theme
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
<?php
|
||||
$posts = get_post_query('post', 1, 'ASC', '', 'interviews');
|
||||
$posts = new WP_Query([
|
||||
'category_name' => 'interviews',
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => 1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC'
|
||||
]);
|
||||
|
||||
if ($posts->have_posts()) :
|
||||
while ($posts->have_posts()) :
|
||||
|
||||
@@ -7,7 +7,7 @@ if ($pinned_post) :
|
||||
|
||||
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="hero-banner">
|
||||
<div class="hero-banner__bg">
|
||||
<?= show_post_image($pinned_post->ID, 'large'); ?>
|
||||
<?= show_post_image($pinned_post->ID); ?>
|
||||
</div>
|
||||
<p class="hero-banner__main">Главное</p>
|
||||
<div class="hero-banner__content">
|
||||
|
||||
@@ -8,30 +8,16 @@ if ($query->have_posts()) {
|
||||
$post_count++;
|
||||
$query->the_post();
|
||||
get_template_part('content', 'post', ['full_width' => $post_count === 1 && $large_first_image]);
|
||||
if ($post_count === ($large_first_image ? 5 : 4)) {
|
||||
$banners = wp_is_mobile() ? get_field('banner_between_posts_mobile', 'option') : get_field('banner_between_posts', 'option');
|
||||
if($banners){
|
||||
$rand_keys = array_rand($banners, 1);
|
||||
if (isset($banners[$rand_keys]) && !empty($banners[$rand_keys]['image_banner'])) {
|
||||
echo '<a href="' . $banners[$rand_keys]['link'] . '"><div class="banner-middle">
|
||||
<img src="' . $banners[$rand_keys]["image_banner"]["url"] . '" alt=""></a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ($post_count === ($large_first_image ? 5 : 4)) : ?>
|
||||
<div class="banner-middle desktop">
|
||||
<?php if (function_exists('banners_conf_display')) banners_conf_display('content_banner_desktop'); ?>
|
||||
</div>
|
||||
<div class="banner-middle mobile">
|
||||
<?php if (function_exists('banners_conf_display')) banners_conf_display('content_banner_mobile'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
wp_reset_postdata();
|
||||
}
|
||||
?>
|
||||
|
||||
<style>
|
||||
.banner-middle img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.banner-middle {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
?>
|
||||
Reference in New Issue
Block a user