0

I am having a problem displaying the content using ACF and flexible fields. I made a custom option page and I want to call the fields from the options page but everything is coming back blank when I try to get the values from the actual field.

This is my Code.

if( have_rows('season_title', 'option') ):

    while ( have_rows('season_title', 'option') ) : the_row();

        if( get_row_layout() == 'seasonal_title' ):

           print_r(the_sub_field('s_title'));

        endif;

    endwhile;

else :

    // no layouts found

endif;

This is the configuration on my field

enter image description here

Any ideas what im doing wrong?

  • Could you show your code for setting up the options page? – ngearing Jun 24 '15 at 2:12
  • @Nath it's in the post – Jeremy Love Jun 24 '15 at 6:22
  • Your row layout might need option: if( get_row_layout() == 'seasonal_title' ):. – Aibrean Jan 21 '16 at 20:24
0

According to ACF Docs on Get values from an options page.

You should use 'option' not 'options' as the second parameter to the have_rows() function.

<?php if( have_rows('repeater', 'option') ): ?>

    <ul>

    <?php while( have_rows('repeater', 'option') ): the_row(); ?>

        <li><?php the_sub_field('title'); ?></li>

    <?php endwhile; ?>

    </ul>

<?php endif; ?>
  • Option is in my code, however that still does not solve the problem I am having – Jeremy Love Jun 23 '15 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.