In a wordpress theme I am programming, I created a custom post type and its template. This custom post type displays a list thanks to advance custom fields that I attached to the post template. In fact, I used the "repeater" field of Advance custom fields pro. The user only has to insert items of the list when editing the post. I am trying to do the following: I want to display in two specific pages templates the post with all its custom fields (the list created through the repeater). I am not able to do that, I only can retrieve the "normal" fields of the post (the title, the content...). I created a snippet so you can look at my code.
<?php //the single of the post: ?>
<ul class='slider-partners'>
<?php
//slider partners
if( have_rows('slider_partenaires_hp') ): //"slider_partenaires_hp" is the repeater field
// loop through the rows of data
while ( have_rows('slider_partenaires_hp') ) : the_row();
// display a sub field value
echo "<li class='partenaire-slide'><img src='" . get_sub_field('logo_partner') . "'></li>"; //"logo_partner" is the item inside the repeater field
endwhile;
else :
// no rows found
endif;
?>
</ul>
<?php //the template of the page where I try to retrieve the 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 you please help me in calling a post with all its custom fields in two diferent pages ? Thanks