Home › Forums › Front-end Issues › How to display custom post with acf fields from within repeater in flexible cont › Reply To: How to display custom post with acf fields from within repeater in flexible cont
Thanks for the screenshots and explanation.
You need to use get_field() instead of get_sub_field() when you try to get the field from a post object. You can also set the ID for the second parameter of get_field() to make sure it gets the right value. It should be something like this:
<?php if( get_field('klasa_obrazka', $post->ID)): ?> <h5><?php the_field('klasa_obrazka', $post->ID); ?></h5> <?php endif; ?>
I hope this helps.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.