Support

Account

Forum Replies Created

  • Thanks a lot for the extensive explanation! I actually tried your first choice before but when I looked at it I got scared! Haha! Nothing had names, nothing… I thought there must be a way I’m not seeing… seems not… :/

    But yeah, I think the first choice will do the trick with a bit more work…

    The second, just for you to know, not sure if you’re from the ACF team and you’re interested, but the error was related to this thread. There seems to be no reason for it from what I see from people. Well, a reason may be not using the “while have_rows” immediately after the “if have_rows”, I don’t know, but that’s not an option for me because I need something in between.

    Well, again, many thanks for the quick answers!
    Cheers!

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