Hi Tom, Remember me?
I just wanted to report back that I have finally succeeded in doing all I needed with the Portfolio custom post type and thought I’d share it here with people who want to do the same:
My quest was to show both categories and tags for masonry portfolio posts and make it possible to filter the posts by category.
I also wanted to be able to show the current category, but was frustrated that I got the category posts in the generic archive template, not the portfolio template. Here’s how I made it work:
In my child theme I created an archive-portfolio.php template and a content-portfolio.php template.
In the archive-portfolio template I hardcoded the page title like so
(There is probably a more elegant way to do it, but it served the purpose for my needs.)
In content-portfolio.php I added this to show the tags (thanks for pointing me in that direction):
<?php echo get_the_term_list( $post->ID, 'portfolio_tag', 'tags: ', ', ' ); ?>
To show the categories I created a custom menu for my portfolio categories and added this in the header of archive-portfolio.php:
<? wp_nav_menu( array( 'theme_location' => 'portfolio-menu' ) ); ?>
Now the great thing I discovered was that I could duplicate the portfolio-archive.php and name it taxonomy.php and then I would get my category posts displayed with the Portfolio title instead of the archive title and keep my custom menu in the header. Not only that, but the custom menu for portfolio categories identified the current link item (category), so that I can style it to stand out and serve as a page title. Such a simple solution to something that I just could not figure out for the longest time!
Hope it will be useful for people who want to do something similar and thank you so much for all your help and support during the long incubation. Will post the site link when we launch