In order to get an option field from an ACF Options Page, you need to use the string ‘option’ as the $post_id parameter in your get_field() call. How to get values from an options page documentation.
The location of the call in your templates should not matter.
Here is some sample code to get values from an options page repeater:
<?php if( have_rows('repeater-field-name-or-field-key', 'option') ): ?> <ul> <?php while( have_rows('repeater-field-name-or-field-key', 'option') ): the_row(); ?> <li><?php the_sub_field('page_for_posts'); ?></li> <?php endwhile; ?> </ul> <?php endif; ?>
Help your fellow forum-goers and moderation team; if a response solves your problem, please mark it as the solution. Thank you!
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!
© 2022 Advanced Custom Fields.