Home › Forums › Add-ons › Repeater Field › Repeater to show certain row
Okay, I’m partly succeeding in what I’m trying to do. I want the certain row to show, when a certain field’s input matches the title of the page, to display that row. Currently, it does display the brand_name correctly, but none of the other fields (such as brand_logo) actually display. Help?
if (have_rows('brand_checklists', 'option')):
if (have_rows('brand_checklists', 'option')) : the_row();
if (get_sub_field('brand_name') == the_title()) {
the_sub_field('brand_name');
the_sub_field('brand_logo'); //this is what does not display
}
endif;
else :
// no rows found
endif;
I’m not exactly sure what your seeing or why, but your if statement is likely the cause since it will give unexpected results
if (get_sub_field('brand_name') == the_title()) {
the_title() echos the title of the post so every pass through the loop is echoing the title. I don’t know what results from attempting to compare a value to an echoed value.
try using get_the_title()
For some reason, it solved my problem on one of my pages (the one with the first row). However, for the other pages that need a row further down in the repeater, nothing is displayed.
In fact, I made the discovery that getting rid of the contents of my inner if, it still only displays the first column. Even with the inner contents gone.
if (have_rows('mermaid_tail_brand_checklists', 'option')):
if (have_rows('mermaid_tail_brand_checklists', 'option')) : the_row();
if (get_sub_field('brand_name') == the_title()) {
the_sub_field('brand_name'); //both of these do not make a difference in the display if they are deleted
the_sub_field('brand_logo'); //both of these do not make a difference in the display if they are deleted
}
endif;
else :
// no rows found
endif;
The topic ‘Repeater to show certain row’ is closed to new replies.
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.