I’m not sure what I’m doing wrong and my Google skills are failing me today…
I have a Flexible Content group set up with six sections, all called in the main single.php template in template parts. One section shows images. All fine so far. All I want to do is have a radio button for landscape or portrait, so one can be selected and output a landscape custom size image or a portrait one.
This works fine on another custom template on the site:
<?php if( get_sub_field(‘orientation’) == ‘portrait’): ?>
<?php echo wp_get_attachment_image( $image, ‘portrait’ ); ?>
<?php elseif ( get_sub_field(‘orientation’) == ‘landscape’ ): ?>
<?php echo wp_get_attachment_image( $image, ‘hero’ ); ?>
<?php endif; ?>
but will not work within the template part. I’m driving myself mad with passing variables to the template part, and set_query_var() and lots of things I don’t understand…
This is very boring I know, but does anyone have any ideas?!
[ad_2]