How to call in Custom Post-Type Categories?

I have our portfolio page here:

The orange links below the project title are manually inserted on the page content. Is there a way to call in a the post categories to make this automatic?

The template I’m using doesn’t have our portfolio posts under WP Posts. It’s under a custom post-type titled “Portfolio”.

I have received this code below. But I don’t know how to add it to my page. When I tried everything on the page below the PHP code disappeared.

$args = array( 
    'type'                     => 'post', 
    'child_of'                 => 0, 
    'parent'                   => '', 
    'orderby'                  => 'name', 
    'order'                    => 'ASC', 
    'hide_empty'               => 1, 
    'hierarchical'             => 1, 
    'exclude'                  => '', 
    'include'                  => '', 
    'number'                   => '', 
    'taxonomy'                 => 'your_custom_taxonomy', 
    'pad_counts'               => false ); 
$categories = get_categories($args); 

echo '<ul>'; 

foreach ($categories as $category) { 
    $url = get_term_link($category);?> 
    <li><a href="<?php echo $url;?>"><?php echo $category->name; ?></a></li> 

echo '</ul>'; 


Solutions Collecting From Web of "How to call in Custom Post-Type Categories?"

It’s hard to be sure without knowing what Taxonomy the “Portfolio” post type is using. Even though it’s a different post type, it might still be using the default category taxonomy. If it is, then you don’t need to use get_categories(); as you’re doing above. The following should work:

<?php get_the_category_list('|'); ?>

The reason your code doesn’t work is because 'your_custom_taxonomy' isn’t a valid taxonomy. You can always turn on debugging in WordPress to show you any errors that are popping up, instead of just seeing a blank page.

For more info, see get_the_category_list and get_categories.

If you’re trying to display only the terms that are applied to a given post (not all of the categories available), for a taxonomy portfolio_category, try the following:

<?php echo get_the_term_list( $post->ID, 'portfolio_category' ); ?>