php - Retrieve a post with its ACF repeater fields in wordpress -


in wordpress theme programming, created custom post type , template. custom post type displays list advance custom fields attached post template. in fact, used "repeater" field of advance custom fields pro. user has insert items of list when editing post. trying following: want display in 2 specific pages templates post custom fields (the list created through repeater). not able that, can retrieve "normal" fields of post (the title, content...). created snippet can @ code.

<?php //the single of post: ?>  <ul class='slider-partners'>      <?php      //slider partners      if( have_rows('slider_partenaires_hp') ): //"slider_partenaires_hp" repeater field            // loop through rows of data          while ( have_rows('slider_partenaires_hp') ) : the_row();                // display sub field value              echo "<li class='partenaire-slide'><img src='" . get_sub_field('logo_partner') . "'></li>"; //"logo_partner" item inside repeater field            endwhile;      else :            // no rows found        endif;            ?>  </ul>    <?php //the template of page try retrieve above post:        $the_query = new wp_query(array(      'post_type'      => 'our-partners',      'posts_per_page' => 1,      'order'          => 'desc'      ));   while ( $the_query->have_posts() ) :       $the_query->the_post();        endwhile;       wp_reset_postdata();  ?>

could please me in calling post custom fields in 2 diferent pages ? thanks


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -