add new main news in mobail
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="content-middle articles-wrapper">
|
||||
<?php get_template_part('partials/pinned-post-mob'); ?>
|
||||
<?php get_template_part('partials/rubrics-mobile'); ?>
|
||||
<div class="articles-preview">
|
||||
<?php
|
||||
|
||||
@@ -8,4 +8,3 @@ services:
|
||||
- ./public:/app/public
|
||||
ports:
|
||||
- 5173:5173
|
||||
restart: always
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
.main-title-mob{
|
||||
display: none;
|
||||
font-weight: bold;
|
||||
color: #006842;
|
||||
margin: 12px 0 12px 0;
|
||||
}
|
||||
|
||||
.article-item-mob{
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.article-item {
|
||||
width: 100%;
|
||||
@@ -119,6 +130,15 @@
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
.article-item-mob{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.main-title-mob{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.article-item__image-container img {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
.hero__container {
|
||||
padding: 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.hero__inner {
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.menu {
|
||||
display: none;
|
||||
padding: 1.5rem 0;
|
||||
overflow: auto;
|
||||
background: #edefe4;
|
||||
|
||||
26
partials/pinned-post-mob.php
Normal file
26
partials/pinned-post-mob.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
$sticky_posts = get_option('sticky_posts');
|
||||
|
||||
// Получаем последний идентификатор прилепленного поста
|
||||
$last_sticky_post_id = end($sticky_posts);
|
||||
|
||||
// Получаем объект поста по его идентификатору
|
||||
$pinned_post = get_post($last_sticky_post_id);
|
||||
|
||||
if ($pinned_post):?>
|
||||
|
||||
<div сlass="main-title-mob" style="font-weight: bold; color: #006842; margin: 12px 0 12px 0;">Главное</div>
|
||||
|
||||
<div class="article-item__text article-item-mob">
|
||||
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="article-item__image-container">
|
||||
<?=show_post_image( $pinned_post->ID ); ?>
|
||||
<div class="tag article-item__tag"><?=esc_html(get_category_name($pinned_post));?></div>
|
||||
</a>
|
||||
<div class="article-item__text">
|
||||
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="subtitle-16 article-item__link"><?php echo get_the_title($pinned_post->ID); ?></a>
|
||||
<p class="article-item__descr text-13"><?php echo get_the_excerpt($pinned_post->ID); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
@@ -1,6 +1,15 @@
|
||||
<?php
|
||||
// Получаем объект закрепленного поста из ACF поля 'pinned_post'
|
||||
$pinned_post = get_field('pinned_post', 'options');
|
||||
//$pinned_post = get_field('pinned_post', 'options');
|
||||
|
||||
$sticky_posts = get_option('sticky_posts');
|
||||
|
||||
// Получаем последний идентификатор прилепленного поста
|
||||
$last_sticky_post_id = end($sticky_posts);
|
||||
|
||||
// Получаем объект поста по его идентификатору
|
||||
$pinned_post = get_post($last_sticky_post_id);
|
||||
|
||||
|
||||
if ($pinned_post) :
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user