phprockers-logo

How to get the post tags for current post/page?

We can easily get the post tags for current post using following code and give the link for each post tags.

<?php
$current_post_tags = wp_get_post_tags($post->ID);
$post_tags_link .= '<ul class="post-tags-link">';
for($i=0; $i < count($current_post_tags ); $i++) {
$post_tags_link .= '<li><a href ="'.get_bloginfo('url').'/'.$current_post_tags[$i]->slug.'">'.$current_post_tags[$i]->name.'</a></li>';           

$post_tags_link .= '</ul>';
//echo "<pre>";print_r($current_post_tags);
?>
Find more about:<?php echo $post_tags_link; ?>

0 comments:

Post a Comment