Print All Tag & Categories Of A Blog Post

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email

DISPLAY TAGS

<div class="single-tags">
   <?php foreach( get_the_tags($post->ID) as $tag ): ?>
   <a href="<?php echo get_tag_link($tag->term_id); ?>" rel="tag">
   <?php echo $tag->name; ?>
   </a>
   <?php endforeach; ?>
</div>

DISPLAY CATEGORIES

<div class="single-categories">
   <?php
      $categories = get_categories();
      foreach($categories as $category):
   ?>
   <a href="<?php echo get_category_link($category->term_id); ?>" rel="category tag">
   <?php echo $category->name; ?>
   </a>
   <?php endforeach; ?>
</div>
Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert