- This topic has 9 replies, 3 voices, and was last updated 1 year, 7 months ago by
David.
-
AuthorPosts
-
November 2, 2020 at 6:41 am #1514384
Samuel
Hi,
I have a CPTs and I would like to display Taxonomyies related to this CPTs in a hero header.
I tried to insert the filters I found in the forum (generate_footer_meta_post_types or generate_entry_meta_post_types) in a Element.
And then I used the {{post_terms.taxonomy}} to display taxonomy in a Element Header for my CPT but it’s not working.
Thanks for your help
November 2, 2020 at 8:05 am #1514756David
StaffCustomer SupportHi there,
did you change the template tag:
{{post_terms.taxonomy}}
to the taxonomy slug you want displayed?eg. for the Category you would use this:
{{post_terms.category}}
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 2, 2020 at 8:35 am #1514811Samuel
Hi David,
This is not working, I might missing something here is what I’ve got :
– CPT name : tour
– Element with two functions because I don’t know which one is useful :
<?php add_filter( 'generate_footer_meta_post_types', function( $types ) { $types[] = 'tour'; return $types; } ); add_filter( 'generate_entry_meta_post_types', function( $types ) { $types[] = 'tour'; return $types; } ); ?>
– Element with Header for CPT :
<h1> {{post_title}} </h1> <h4> {{post_terms.category}} </h4> <h4> {{post_terms.taxonomy}} </h4>
November 2, 2020 at 9:59 am #1514941David
StaffCustomer SupportIs
tour
the name of your taxonomy ? If so the template tag needs to be:{{post_terms.tour}}
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 2, 2020 at 10:13 am #1514966Samuel
Hi,
There is a misunderstanding here. Tour is my CPT name.
And what I need to display is dynamic, it’s displaying the category depending of which category is marked for each CPT
I mean one CPT can be marked as Category A, another CPT can be marked as Category B, and I need to display to proposer category for the proper CPT.
I don’t know how to explain it more specifically
November 2, 2020 at 2:28 pm #1515291Tom
Lead DeveloperLead DeveloperHi there,
Is your CPT using custom taxonomies? Or is it using the core Category taxonomy (shared with regular posts)?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 2, 2020 at 3:47 pm #1515339Samuel
Yes it’s using custom taxonomy
November 3, 2020 at 3:44 am #1515803David
StaffCustomer SupportWhat is the name of the custom taxonomy ?
e.g if were namedcountry
then the template tag would be:{{post_terms.country}}
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 3, 2020 at 4:08 am #1515844Samuel
Ok I got it…
Sorry about that and thanks for your patience.
SamuelNovember 3, 2020 at 6:04 am #1515972David
StaffCustomer SupportNo problems – glad we could be of help.
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.