Advertise on Site! You can Advertise on our site. Find out More

how to display post count of all wordpress tags

2 Flares Twitter 2 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 2 Flares ×

In wordpress post we use the many post tags. For SEO purpose we can show the post 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> ';
}
}
}
?>

how-to-display-post-count-of-wordpress-tags

2 Flares Twitter 2 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 2 Flares ×
2 Flares Twitter 2 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 2 Flares ×