ACF fields displaying in the theme

Asked by At

I need to display my AFC fields in my theme. my theme owner say me You should edit single-room-type.php file. But i couldn't find where should i add my ACF codes in this file. i think i must edit another file. Any ideas how to do this?

<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 Answers

0
Romel Indemne On
//-----------------------------------------------------
// 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 {