Support

Account

Home Forums Front-end Issues Repeater Field within Media Attachment

Helping

Repeater Field within Media Attachment

  • Hey guys,

    I have added some custom fields to image attachments in order to be able to add additional info. Have followed the instructions as per https://www.advancedcustomfields.com/resources/adding-fields-media-attachments/
    However I can’t get it to display.

    $fashionCredit has data as if I use an if echo to check it will give a return, but the following gives me no output (fieldnames are correct)

    Any ideas?

    		if( get_row_layout() == 'diptych-image-group' ):
    					echo '<div class="diptych">';
    					$diptychimage1 = get_sub_field('diptych-1');
    						if( !empty($diptychimage1) ):
    							echo '<div><img src="';
    							echo $diptychimage1['url']; 
    							echo '" alt="';
    							echo $diptychimage1['alt']; 
    							echo '" />';
    							$fashionCredits = get_field('fashion_credits', $diptychimage1['id']); 
    							if( have_rows( $fashionCredits ) ): echo '<ul class="fashionCredits">'; 
    									while( have_rows($fashionCredits) ): the_row();
    										echo '<li><span style="text-transform uppercase;">'; echo the_sub_field('designer_credit'); echo '</span> '; echo the_sub_field('garment_name'); echo '</li>'; 
    									endwhile;
    								echo '</ul>'; endif;	
    							echo '</div>';
    						endif;
    						if( !empty($diptychimage2) ):
    							echo '<div><img src="';
    							echo $diptychimage2['url']; 
    							echo '" alt="';
    							echo $diptychimage2['alt']; 
    							echo '" />';
    							$fashionCredits = get_field('fashion_credits', $diptychimage2['id']); 
    														if( have_rows( $fashionCredits ) ): echo '<ul class="fashionCredits">'; 
    																while( have_rows($fashionCredits) ): the_row();
    																	echo '<li><span style="text-transform uppercase;">'; echo the_sub_field('designer_credit'); echo '</span> '; echo the_sub_field('garment_name'); echo '</li>'; 
    																endwhile;
    															echo '</ul>'; endif;
    							echo '</div>';
    						endif;
    					echo '</div>';
    				endif;
  • 
    if( have_rows( $fashionCredits, $diptychimage2['id'] ) )
    
    
    while( have_rows($fashionCredits, $diptychimage2['id']) )
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.