Guest User

Untitled

a guest
May 23rd, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. if (have_posts()) :
  2. while (have_posts()) : the_post();
  3. // Get the custom taxonomy terms for the post
  4. $terms = get_the_terms(get_the_ID(), 'custom_category');
  5.  
  6. // Check if terms exist and display them
  7. if ($terms && !is_wp_error($terms)) {
  8. echo '<div class="post-taxonomies">';
  9. echo '<h2>Custom Categories:</h2>';
  10. echo '<ul>';
  11. foreach ($terms as $term) {
  12. echo '<li>' . esc_html($term->name) . '</li>';
  13. }
  14. echo '</ul>';
  15. echo '</div>';
  16. }
  17. endwhile;
  18. endif;
Advertisement
Add Comment
Please, Sign In to add comment