Created
March 8, 2018 20:10
-
-
Save eliasfaical/c7eb39f0ef150681e588e3fe6860aadd to your computer and use it in GitHub Desktop.
This file contains 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 | |
// Get terms for post | |
$terms = get_the_terms( $post->ID , 'oil' ); | |
// Loop over each item since it's an array | |
if ( $terms != null ){ | |
foreach( $terms as $term ) { | |
$term_link = get_term_link( $term, 'oil' ); | |
// Print the name and URL | |
echo '<a href="' . $term_link . '">' . $term->name . '</a>'; | |
// Get rid of the other data stored in the object, since it's not needed | |
unset($term); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment