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; ?>