Support

Account

Home Forums General Issues Use get_sub_field outside have_rows Reply To: Use get_sub_field outside have_rows

  • Hey, here it is:

    $content_blocks = get_field('content_blocks', $project->ID);
    
    if( $content_blocks ):
    	foreach ($content_blocks as $key => $content_block): 
    
    		$layout = $content_block['layout'];
    		$block_type = $classes[ $content_block['acf_fc_layout'] ];
    
    		$start = $content_block['start_at'];
    		$stop = $content_block['stop_at'];
    
    		if( $block_type == 'block__image' ): 
    
    			$image = $content_block['image'];
    			$image_url = $image['sizes']['post-thumbnail'];
    			...
    
    		elseif( $block_type == 'block__video' ):
    			// Here is the problem... can't get the video the same way as with the image
    			$video = $content_block['video'];
    			// $video_url = get_sub_field('video', false, false);
    			...
    
    		endif; 
    	endforeach;
    endif;