Support

Account

Home Forums General Issues Conditional Select Field Value

Solved

Conditional Select Field Value

  • Hey!

    Trying to trigger variable content based on the value set on a select custom field on an user’s page. For some reason, all this code below is giving me is the label of the select field and not the content I want it to trigger.

    Has anyone any ideas of where I’m going wrong?

    <?php if(the_field('expertise', $curauth) == "retail"): ?>
       			 <p>The Content if Expertise is equal to retail.</p>
    		<?php endif; ?>

    Cheers

  • You need to use get_field(). the_field() echos the content of the field.

    
    <?php 
      if(get_field('expertise', $curauth) == "retail"): ?>
       <p>The Content if Expertise is equal to retail.</p>
    		<?php endif; ?>
    
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Conditional Select Field Value’ is closed to new replies.