Created
July 30, 2018 16:03
-
-
Save jocastaneda/44b876cf3ee9e0de683435c93ca4f6b9 to your computer and use it in GitHub Desktop.
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 // add_shortcode needs to return a string. | |
function tags_function() { | |
$termsSecteur = get_the_terms( $post->ID , 'secteur' ); | |
if ( $termsSecteur != null ) { | |
foreach ( $termsSecteur as $termsSecteur ) { | |
$termsSecteur_link = get_term_link( $termsSecteur, 'secteur' ); | |
$return .= sprintf( '<a class="tag-secteur" href="%1$s">%2$s</a>', $termsSecteur_link, $termsSecteur->name ); | |
unset( $termsSecteur ); | |
} | |
} | |
return $return; | |
} | |
add_shortcode( 'list_tags', 'tags_function' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment