Support

Account

Home Forums Add-ons Repeater Field repeater code causes white screen of death Reply To: repeater code causes white screen of death

  • In ACF, I’ve used field-group prefixes on all fields to try to prevent conflicts; these use cg_. Apart from the repeater field, this function is a duplicate of another that works (with a different prefix!).

    I’ve pared down the function enough for you to see how I’ve grabbed other fields and how I’m trying to grab the repeater fields. This shortened version still white-screens when I include the while have_rows line.

    <?php 
        function sal_display_code_grid_item()
        {
            global $post;
            {
                echo( '<div class="outside">');    
    
                echo ( '<div class ="my-header">' );
                $thispicture = get_field( "cg_pretty_picture" , $post->ID );
                echo( '<img src="' . $thispicture . '"/>'); 
                
                echo ( '</div><!-- end header -->' ); //end header
                
                echo( '<div class="inside">' );
                
                /*https://www.advancedcustomfields.com/resources/have_rows*/    
                echo( '<ul>' );
                
                if( have_rows('cg_the_links', $post->ID ) )
                {
                    //tried with and without $post->ID, but I think that I need it
                    while( have_rows('cg_the_links', $post->ID ) ): the_row();  
                    {
                        $thislink = get_sub_field('cg_link_url', $post->ID );
                        $thislinktext = get_sub_field('cg_link_text', $post->ID );
                
                        echo( '<li>' );
            
                        echo( '<a href="' . $thislink . '">' . $thislinktext . '</a>' );
            
                        echo( '</li>' );
    
                    }
    
                }
                echo( '</ul>' );
                
                echo ( '</div>'); //end of inside div
                
                echo( '</div>' ); //end of outside
            }
        }
    ?>