@Spisoktem

Как в WP написать условие чтобы в определенной записи рубрики отображались конкретные блоки, а в остальных записях их не было??

if (in_category($production)) {
    if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

        <section class="single_page">
            <div class="container">
                <div class="row contentBox">
                    <div class="col-xs-12">
                        <div class="titleBox">
                            <h3><?php wp_title(''); ?></h3>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-9">

                        <div class="wrapp_content">

                            <?php the_content(); ?>

                            <?php if ($_post == 49) { ?>
                                <div class="intro_text">
                                    <p><?php the_field('intro'); ?></p>
                                </div>
                                <div class="titleFurniture">
                                    <h4><?php the_field('opportunities_title'); ?></h4>
                                </div>
                                <div class="imgBoxFurniture">
                                    <?php
                                    if( have_rows('opportunities') ):
                                        while ( have_rows('opportunities') ) : the_row(); ?>

                                            <div class="item">
                                                <img src="<?php the_sub_field('opportunities_img'); ?>" alt="logo">
                                                <h4 class="title">
                                                    <?php the_sub_field('title_img_opportunities'); ?>
                                                </h4>
                                            </div>

                                        <?php endwhile;
                                    else :
                                    endif;
                                    ?>
                                </div>
                                <div class="textBox">
                                    <?php the_field('opportunities_text'); ?>
                                </div>
                            <?php } ?>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-3">
                        <div class="menuNav">

                        </div>
                    </div>
                </div>
            </div>
        </section>

    <?php endwhile;
}

Прописываю так чтобы для ($_post == 49) выводились свои блоки , но они появляются и в других записях. Подскажите что не правильно я прописываю ?
  • Вопрос задан
  • 107 просмотров
Решения вопроса 1
@ArturArturov
get_the_ID() == 49
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы