vendredi 17 avril 2015

ACF Post Object not working

I am using ACF (Advanced Custom Fields) in my wordpress site. Currently, I am trying to get some 'related products' working in a page.


In my ACF, I have the following: ACF screenshot


And for my code I have the following:



if( have_rows('related_product') ):

// loop through the rows of data
while ( have_rows('related_product') ) : the_row();

if( get_row_layout() == 'product_name' ): ?>

<ul style="list-style-type:none; padding-left:0;">
<li><a href="<?php the_sub_field('product_link'); ?>"><?php the_sub_field('product_1'); ?></a></li>
</ul>



<?php elseif( get_row_layout() == 'download' ):

$file = get_sub_field('file');

endif;

endwhile;

else :

// no layouts found

endif;

?>


If I change the post_object field to just text, this works perfectly. But I would rather have it so the user could select the product using Post_object.


Any help?


Cheers.


Aucun commentaire:

Enregistrer un commentaire