Отображение полей ACF в теме - PullRequest
0 голосов
/ 18 апреля 2019

Мне нужно отобразить поля AFC в моей теме.мой владелец темы скажет мне Вы должны отредактировать файл single-room-type.phpНо я не мог найти, где я должен добавить свои коды ACF в этом файле.Я думаю, что я должен отредактировать другой файл.Есть идеи как это сделать?

<section class="content-editor">
<?php
while ( have_posts() ) : the_post();

    if ( post_password_required() ) {
        echo get_the_password_form();
        return;
    }
    ?>

        <?php do_action( 'mphb_render_single_room_type_before_content' ); ?>

        <?php
        /**
         * @hooked \MPHB\Views\SingleRoomTypeView::renderTitle              - 10
         * @hooked \MPHB\Views\SingleRoomTypeView::renderFeaturedImage      - 20
         * @hooked \MPHB\Views\SingleRoomTypeView::renderDescription        - 30
         * @hooked \MPHB\Views\SingleRoomTypeView::renderPrice              - 40
         * @hooked \MPHB\Views\SingleRoomTypeView::renderAttributes         - 50
         * @hooked \MPHB\Views\SingleRoomTypeView::renderCalendar           - 60
         * @hooked \MPHB\Views\SingleRoomTypeView::renderReservationForm    - 70
         */
        //do_action( 'mphb_render_single_room_type_content' );
        ?>

    <?php the_content(); ?>

    <?php do_action( 'mphb_render_single_room_type_after_content' ); ?>

<?php
endwhile;
?>
</section>

1 Ответ

0 голосов
/ 18 апреля 2019
//-----------------------------------------------------
// Single Output
//-----------------------------------------------------
if(is_single()){ ?>
  <section class="content-editor">
    <?php while (have_posts()) : the_post(); ?>

        <!-- Add your acf field here -->
        <div class="your-acf-field"><?php echo get_field('your_acf_field', 
          get_the_ID());?></div>

        <?php the_content(); ?>
    <?php endwhile; ?>
  </section>
 <?php } else {
...