I have property
as a custom post type. I want to display a specific message if the property is in the sold
category. To do that, I’m using the function below:
if ( has_term('sold', 'category')) {
?>
<div class="sold_prop_note">
<h3>This Property is sold. Take a look at our current exclusives! <a href="https://wordpress.stackexchange.com/properties">View Exclusives</a></h3>
</div>
<?
}
Before using the above, I also tried in_category like the one below:
if ( in_category( array( 'sold', 'homepage-sold' ) )) {
?>
<div class="sold_prop_note">
<h3>This Property is sold. Take a look at our current exclusives! <a href="https://wordpress.stackexchange.com/properties">View Exclusives</a></h3>
</div>
<?
}
Both of the haven’t worked. To add the Custom Post Type, the taxonomies were with 'taxonomies' => array( 'category', 'post_tag' )
.
Both are being used inside the loop (via a shortcode). Am I missing something?