• I want to display only the custom post type categories in an unordered list. I’ve tried several different solutions I found on Google and on here, on this forum, but none of them seem to work.

    How would I do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • This code works for me (taken from my theme):

    <?php
    $args = array(
        'type'                     => 'childrenscakes',
        'taxonomy'            => 'childrenscakes-category',
     );
    
    $categories = get_categories( $args );
    foreach($categories as $cat){ ?>
        <span class="ref"><?php echo $cat->name; ?></span>
     <?php } ?>

    I hope this helps!

    Thread Starter The_Gray_Wolf

    (@the_gray_wolf)

    Could I make custom taxonomies and then display them?

    wp_list_categories( array(
        'taxonomy' => 'customtaxonomy'
    ) )
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to loop through categories of only custom post types?’ is closed to new replies.