Archived topic
Pull Dynamic Data from Post Taxonomy?
10 replies · Started by Tom on April 5, 2023
Hi,
- I have a custom post type called "Position"
- It contains a taxonomy that shows if position is "Hiring" or "Not Hiring".
- The Position post is displayed using a BLOCK-CONTENT TEMPLATE (Appearance>Elements)
- All the dynamic data is pulled from Custom Fields using post_meta. (I know how to do this)
The taxonomy is generated from the individual Post information (obviously as opposed to the custom fields).
I don't know HOW to pull that Taxonomy information from the post INTO the Content Template.
Any help is appreciated! Thank you.
Found the answer (David answered previously):
1. for that list of terms, use the GP Dynamic Data options for now:
https://docs.generatepress.com/article/dynamic-data/
It has a free field for typing in your taxonomy.
The option is called "List of Terms"
Glad to hear you found the answer!
David - this is a theoretical question...
Could the taxonomy terms have, just as easily existed - not as TAXONOMIES - but as Custom Fields with a radio button?
I guess I am not understanding the difference (taxonomy vs. custom field) - and which is actually better?
Answer when you have time. Thanks!
The main difference is that Taxonomies have a set standard and baked in codebase with WP.
WP automatically generates archives for them, they can be queried using WP_query as well conditionally checked using template tags.
Whereas Custom Fields are more generic, WordPress doesn't make any assumptions for them, other then a key and value will be saved for them. Apart from that they don't do anything unless you code it otherwise.
But they are good for creating radio buttons to check a specific taxonomy term
Gotcha...
So - in a way - everything I did with my Custom Fields MIGHT have been better served with Taxonomies?
Custom Fields just seem so tidy.
Taxonomies are best used when you want to classify content and query them as such eg. displaying posts in an archive.
But for storing extra data that may not be used for classification is better as a custom field.
You also have the UI benefits of custom fields, where you can have radio options.
Overall, if a custom field feels right to use, then it most probably is.
And if that custom field just provides the UI to set a taxonomy then thats good too.
And i like tidy :)
David,
Last question and I will let this thread rest.
Can you *interactively* filter by Taxonomies using Generate Press (and tricks that might by built into it) - as opposed to using a 3rd party Plugin like FacetWP?
If I have a CPT and QueryLoop display of the CPT -> is there any tricks there?
I have a page with multiple queryLoops for a different CPT - but the multiple QueryLoops each call a different Taxonomy - so, admittedly, that type of sorting is cheating and not truly interactive.
Absolutely not opposed to FacetWP - just seeing if there are options I might already have before I jump. (And if I recall - from a few years ago - FacetWP would call for me to re-author the page with their QL equivalent.)
No rush - whenever you have time.
As always - thanks!
Tom
No, its not possible in GP.
The FacetWP plugin is the best way to go.
And to the best of my knowledge you can use it with a GP Loop Template and the GB Query Loop block set to Inherit from Query.
And it definitely works with the themes loop ( and optionally a GP Content Template )
That's awesome news! Have used it before but probably not for 4 or 5 years.
Thanks David. Will let this thread rest now.
You're welcome!