Home › Forums › Add-ons › Options Page › Option field value not loading on Archive page › Reply To: Option field value not loading on Archive page
Hi FrankiesFolio,
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.