If you are looking to write an IF PHP statement to show content based on whether a contact has a certain ID. The code below worked for me. It’s a hyperlinked image that shows if the member has a specific tag ID.

<?php if ( memb_hasAnyTags( 9388, $contact_id = false ) ) { ?>
<a href=”https://www.example.com/” class=”cell”>
<div class=”clear box”>
<img src=”<?php echo esc_url( get_template_directory_uri() ); ?>/new-assests/images/ow.png”/>
<div class=”title”>
ASK A <br/>
<b>COACH </b>
</div>
</div>

<p>Click to learn more</p>
</a>

<?php }?>

 

If you would like to see how to write the following code if a member does not have a specific tag, please read this blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>