I have a post with it’s own category (aqf level). It’s a drop down with values of ‘aqf5’ to ‘aqf10’:
And I have an options page so that you can assign a header image (fields are named ‘aqf5’ to ‘aqf10’):
I want my post to get its allocated aqf level, and echo the image URL from the field that matches on the options page.
$aqf = get_field( 'aqf_level' );
$featuredImage = get_field( '$aqf', 'option' );
echo '<div class="featured-image background-tint" style="background-image: url(' . $featuredImage['url'] . ' )">';
This doesn’t work because my $featuredImage variable can’t use another variable ($aqf) in this way.
How would you get a value and then match it with another field in the options page?
$featuredImage = get_field( $aqf, 'option' );
Ah thank you John! I did try that, but I must’ve made another mistake. Turns out it was an easy fix! Thank you very much.