Support

Account

Home Forums Add-ons Repeater Field Repeater to show certain row

Solving

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;
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Repeater to show certain row’ is closed to new replies.