Home › Forums › Add-ons › Options Page › Repeater fields don\'t show on archive page
I have a similar problem as shown here: https://support.advancedcustomfields.com/forums/topic/option-field-value-not-loading-on-archive-page/ however I am using repeater fields in a shortcode, here is my code:
function dev_logos_func( $atts ){
$devLogos = '<div id="logos">';
while ( have_rows('development_logos','options') ) : the_row();
$devLogos .= '<a href="'.get_sub_field('dev_url','options').'" target="_blank">'.get_sub_field('dev_name','options').'</a><div class="logosTxt">'.get_sub_field('dev_text','options').'</div>';
endwhile;
$devLogos .= '</div>';
return $devLogos;
}
add_shortcode( 'dev_logos', 'dev_logos_func' );
They show on every page except archive, and also categories.
Some of my other fields where the same such as a image field however I was able to by pass that by doing a conditional statement like this:
if (is_archive()) {
$logoUrl = wp_get_attachment_url( get_field('logo', 'options') );
} else {
$logoUrl = get_field('logo', 'options');
}
However I am unsure what I can do for my repeater fields considering they are just text, url and textarea. I did find this: https://www.advancedcustomfields.com/resources/value-loading-posts-page/ however do not know how I can apply it to my issue.
Any help would be greatly appreciated.
Hi @gab1982 ,
That is quite odd as you are already providing the second parameter for the post ID in the loop.
Have you tried using option as in the documentation as opposed to options.
Kindly try it out and let me know how it goes.
Hi @gab1982
Thanks for the follow up.
Kindly open a support ticket at [email protected] for more personalised support.
Hi James,
Sorry for the long time to reply, I have now posted a ticket.
thanks
Graham
You must be logged in to reply to this topic.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.