Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (have_posts()) :
- while (have_posts()) : the_post();
- // Get the custom taxonomy terms for the post
- $terms = get_the_terms(get_the_ID(), 'custom_category');
- // Check if terms exist and display them
- if ($terms && !is_wp_error($terms)) {
- echo '<div class="post-taxonomies">';
- echo '<h2>Custom Categories:</h2>';
- echo '<ul>';
- foreach ($terms as $term) {
- echo '<li>' . esc_html($term->name) . '</li>';
- }
- echo '</ul>';
- echo '</div>';
- }
- endwhile;
- endif;
Advertisement
Add Comment
Please, Sign In to add comment