Last active
August 19, 2019 02:31
-
-
Save amouratoglou/20f8153303a31497f5c797aff21c34cc to your computer and use it in GitHub Desktop.
Wordpress Show Taxonomy Term Title and Slug inside loop #wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Print term slug | |
$terms = get_the_terms( $post->ID , 'oil' ); | |
if ( $terms != null ){ | |
foreach( $terms as $term ) { | |
print $term->slug ; | |
unset($term); | |
} } | |
// Get term title | |
$terms = get_the_terms( $post->ID , 'oil' ); | |
if ( $terms != null ){ | |
foreach( $terms as $term ) { | |
print $term->name ; | |
unset($term); | |
} } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment