In this article, wordpress tutorial, how to display post count of all wordpress tags. In wordpress post we use post tags. For SEO purpose we can show post tags.
how to display post count of all wordpress tags
If we want to show the post count related to wordpress tags.
You can use following code:
<?php //list all tags that are assigned to posts $taxonomy = 'post_tag'; $terms = get_terms( $taxonomy, '' ); if ($terms) { foreach($terms as $term) { if ($term->count > 0) { echo '<p>' . '<a href="' . esc_attr(get_term_link($term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> '; } } } ?>
Thanks for the code but I couldn’t figure out what I’m doing wrong. It doesn’t display anything.
did you followed everything?