Home Forums Add-ons Options Page Matching a value with another field


Matching a value with another field

  • I have a post with it’s own category (aqf level). It’s a drop down with values of ‘aqf5’ to ‘aqf10’:

    Course award, current value is aqf5

    And I have an options page so that you can assign a header image (fields are named ‘aqf5’ to ‘aqf10’):

    Options page, aqf image fields

    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.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Matching a value with another field’ is closed to new replies.