Support

Account

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

Solved

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.

    	<?php
    	$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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.