1179 posts
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
mabuc says

Hello,

I need some help on how to get a custom tags in single page instead of using the_tags(); function.. here’s my code:

<?php
$taxonomy = 'post_tag';
$terms = get_terms( $taxonomy, '' );
if ($terms) {
foreach($terms as $term) {
if ($term->count > 0) {
?>
<a href="<?php echo esc_attr(get_term_link($term, $taxonomy)) ?>">
<span><?php echo $term->name; ?></span>
</a>
}
}
}
?>

I’m not sure where to insert $post->ID code..

thanks

117 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
fAntasticmE says
for custom taxonomy you should use
<?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?>
for more info look the codex here
by
by
by
by
by
by