samwrigley
10/18/2017 - 2:58 PM

Wordpress - List all (custom post type) post categories

Wordpress - List all (custom post type) post categories

<?php if ($categories = get_the_terms($post->ID, '<taxonomy>')) { ?>
    <ul class="categories">
        <?php foreach ($categories as $category) : ?>
            <li>
                <a href="<?php echo get_term_link($category->slug, '<taxonomy>'); ?>">
                    <?php echo $category->name; ?>
                </a>
            </li>
        <?php endforeach; ?>
    </ul>
<?php } ?>