Skip to content

Instantly share code, notes, and snippets.

@mattradford
Created November 15, 2015 15:49
Show Gist options
  • Save mattradford/10c0e5fbfa7236839758 to your computer and use it in GitHub Desktop.
Save mattradford/10c0e5fbfa7236839758 to your computer and use it in GitHub Desktop.
Get first taxonomy term
$tax = 'property-type';
$tax_terms = wp_get_object_terms( $post->ID, $tax );
if (!empty( $tax_terms )) {
$term = array_pop($tax_terms);
_e('This is a ','turnerestates');
echo '<a href="' . get_term_link( $term->slug, $tax ) . '">' . strtolower($term->name) . '</a>';
_e(' property.','turnerestates');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment