I bought a Wordpress Theme hoping that after some code customisation it should achieve what I want.
Now, I have (what I believe it is) a custom post type called 'Portofolio'. As you can see in the picture below, it has the portofolio entries (at all portofolio) and categories for the aforementioned portofolio entries.
What I am trying to achieve is listing on a custom template page all the categories of the portofolio. So far I have this code but all it does is to fetch the entries of the portofolio not the categories.
<?php
//$args = array('post_type' => 'tm_portfolio');
$term_ids = get_terms( 'tm_portfolio_category', ['fields' => 'ids'] );
$args = [
'tax_query' => [
[
'taxonomy' => 'tm_portfolio_category',
'terms' => $term_ids
]
]
];
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'List of categories';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
As you can see in the code, as the first line, I tried to fetch from the custom post type, but I had the same result.
I figured out the name/slug of the post type/taxonomy by checking the link in the admin panel while adding a category (check the picture below).