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
}
}
?>
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.