Home › Forums › Add-ons › Repeater Field › Have_rows breaks with options page, on page nesting mix › Reply To: Have_rows breaks with options page, on page nesting mix
Thank you John.
So, this technically solved the problem I posted, but a little context is in order.
The three repeaters are in different sections of the site, so they are relatively independent of each other. The content for the third repeater will always be on the options page. The content for the first repeater may or may not be. So, a function I have does something like this:
if(have_rows('custom_modules')){
while(have_rows('custom_modules')){
function_which_accesses_modules();
}
}
elseif (have_rows('custom_modules', 'options'))
{
while(have_rows('custom_modules', 'options'){
function_which_accesses_modules();
}
}
The modules are defined in seperate files. In theory, I could write in every single module something like
if($is_inside_options_page){
while(have_rows('social_icons', 'options'){
// Get social icons
}
} else {
while(have_rows('social_icons') {
// Get social icons
}
}
Or even wrap something like that inside a function, called something like have_options_rows()
which runs have_rows() the correct way, depending on where the first have_rows() is pulling from. But I am creating the modules so that people who are only familiar with WordPress, ACF, & some of my options fields, but not my specific functions, can write modules.
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.