Get list of Portfolio project types
-
Hi i am trying to output a list of all the portfolio project types. Not the ones assigned to a specific post, but all of them (excluding empty).
It’s to use on a custom archive.php – the ideal result would be that on /portfolio it shows all project types, and if you go into one of the project types (like Illustration), it only shows the current one.
I’m not sure if this makes sense, but you can see my current solution here: https://www.earlfoolish.com/portfolio/
This is the code I’ve used, but it feels incredibly convoluted, and I was hoping i’d somehow be able to use just get_the_term_list() instead
<?php // list terms in a given taxonomy $taxonomy = 'jetpack-portfolio-type'; $tax_terms = get_terms( $taxonomy ); foreach ( $tax_terms as $tax_term ) { echo '<a class="filter" href="/project-type/'. $tax_term->slug.'">' . $tax_term->name .'</a>, '; } ?>
In addition, I’d prefer if the comma signs only got added between each item, and not after them. As for now I’ve solved that by using css but once again, it feels convoluted.
Any help appreciated. Thanks!
- The topic ‘Get list of Portfolio project types’ is closed to new replies.