Archived topic
Question on the "magic tags" (short-codes) in Elements > Header
5 replies · Started by Henry on August 20, 2020
In GP, there's a great feature where you can pull out WP metadata like this:
{{post_title}}
This works great, but this does not:
{{post_terms.taxonomy}}
The page I am running this {{post_terms.taxonomy}} is to pull the "category" slug for the page but it doesn't work. I tried:
{{category.taxonomy}}
And no joy.
Is there something I am doing wrong?
Also, in the ideal world I've love to add the same magic tag to a URL like this:
https://my-site.com/filter/{{category.taxonomy}}
So, in summary, what do I need to do to:
1. Make it work to show the category slug?
2. Embed it in a URL?
Thanks!
Hi there,
you would use this:
{{post_terms.category}}
as category is the taxonomy you want to be displayed.
This is not something you can add to a URL - that would be defined by your Permalink structure or an SEO plugin
ok thanks, sorry David, I'm being a bit slow, can you give me an example?
I guess my question is - what are "post_terms" is there a list of them that you can share? Thanks
Taxonomies can be Categories or Tags or a Custom taxonomy if you like e.g books.
When you +new category to your post you're creating a new Category > Post Term.
Likewise +new tag your creating a new Tags > Term
So adding this template tag to the header element:
{{post_terms.category}}
will display all the category > terms for the current post.
Thanks for your help.
You're welcome