- This topic has 3 replies, 2 voices, and was last updated 1 year, 5 months ago by
David.
-
AuthorPosts
-
January 31, 2021 at 9:02 pm #1641064
Craig
Hello
I’m using the standard posts and archive, but have some additional taxonomy terms I’d like to display like the ‘categories’ link below each post content in the archive page (entry meta footer).
I have taxonomies for Actor / Writer / Subject / Style – created with Pods plugin FYI
I have seen this forum post and have tried to use this php code – using the Snippets plugin – and changing ‘content-type’ to ‘actor’, but have been unsuccessful:
https://generatepress.com/forums/topic/post-meta-for-custom-taxonomy-archives-and-category-archive/Here is an image to help show what I’m trying to do:
https://drive.google.com/file/d/1HmcPf8rSQPLDlypTqXYUKpi0ji23eqAh/view?usp=sharingThank you
February 1, 2021 at 7:22 am #1641711David
StaffCustomer SupportHi there,
can you check that the ‘actor’ slug is correct ? Maybe PODs is outputting it differently
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 22, 2021 at 2:20 pm #1668358Craig
Hi David,
Thanks, after some tinkering I was able to get this to work – I had to get singular and plural names in the right order/place.
However I’ve now had to rethink how I structure the website and I’m looking at the WooCommerce option so we can take donations. I’m hoping it’s not too difficult to repurpose this code to work on the WooCommerce product archive template?
Working code for post archive below:
add_action( 'generate_post_meta_items', function( $item ) { if ( 'writers' === $item ) { $types = get_the_term_list( get_the_ID(), 'writer', '', ', ' ); if ( $types ) { printf( '<span class="taxonomy-links">%1$s%2$s | </span>', apply_filters( 'generate_inside_post_meta_item_output', '', 'writers' ), $types ); } } } ); add_action( 'generate_post_meta_items', function( $item ) { if ( 'actors' === $item ) { $types = get_the_term_list( get_the_ID(), 'actor', '', ', ' ); if ( $types ) { printf( '<span class="taxonomy-links">%1$s%2$s | </span>', apply_filters( 'generate_inside_post_meta_item_output', '', 'actors' ), $types ); } } } ); add_action( 'generate_post_meta_items', function( $item ) { if ( 'subjects' === $item ) { $types = get_the_term_list( get_the_ID(), 'subject', '', ', ' ); if ( $types ) { printf( '<span class="taxonomy-links">%1$s%2$s | </span>', apply_filters( 'generate_inside_post_meta_item_output', '', 'subjects' ), $types ); } } } ); add_action( 'generate_post_meta_items', function( $item ) { if ( 'styles' === $item ) { $types = get_the_term_list( get_the_ID(), 'style', '', ', ' ); if ( $types ) { printf( '<span class="taxonomy-links">%1$s%2$s</span>', apply_filters( 'generate_inside_post_meta_item_output', '', 'styles' ), $types ); } } } ); add_filter( 'generate_footer_entry_meta_items', function( $items ) { return array( 'writers', 'actors', 'subjects', 'styles', 'post-navigation', ); } );
Thank you
Craig
February 23, 2021 at 1:22 am #1668786David
StaffCustomer SupportAh Woocommerce has its own entirely different set of templates, with its own hooks. This article shows where all the Product Archive hooks are and what their current purpose are:
https://www.businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/
So you could simply create your own template/function to get the author terms and hook them in place.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.