Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <?php
  2. echo '<div class="post-categories">';
  3.  
  4. $tax = 'category';
  5. $terms = get_the_terms($post->ID, $tax);
  6.  
  7. if (!empty($terms)) :
  8. if (count($terms) === 1) {
  9. echo "<p>Category:</p>";
  10. } else {
  11. echo "<p>Categories:</p>";
  12. }
  13. echo '<ul class="nostyle">';
  14. foreach ($terms as $term) {
  15. echo '<li><a href="' . get_term_link($term->slug, $tax) . '">' . $term->name . '</a></li>';
  16. }
  17. echo '</ul>';
  18. endif;
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement