Archived topic
Enabling Tags in event posts from a 3rd party plugin
3 replies · Started by Simon on March 4, 2022
Hi
I am in the process of setting up the Stachethemes events calendar within a site with GeneratePress Premium. While it offers great things, it does not produce tags. So the event posts will not contribute to the tag cloud, and not be linked by it.
So I want to ask you what each event post needs to have, or produce, in order to be picked up by GP as tags. I have set the Search bar to pick up the event posts (the post_type is 'stec_event') and the events now appear alongside other posts in search results. So it seems like it should be possible... The Calendar already asks for 'key words' for each event, so perhaps that field could somehow be picked up as tags?
I'd be grateful for any ideas or information. Hoping you can help. Best wishes.
Hi there,
the Theme doesn't register taxonomy terms or account for them - its a core WP function.
In theory you should be able to use the register_taxonomy_for_object_type filter:
https://developer.wordpress.org/reference/functions/register_taxonomy_for_object_type/
And heres an example of it being used for adding tags:
add_action( 'init', 'gp_register_taxonomy_for_object_type' );
function gp_register_taxonomy_for_object_type() {
register_taxonomy_for_object_type( 'post_tag', 'portfolio' );
};
Source: https://wordpress.stackexchange.com/a/163785
You will need to swap portfolio for the post type name.
What i cannot say is whether that plugin has included the necessary API support for adding the tags metabox in the editor....
Hi David
Major thank you. I will have a go. That convinces me it should be possible. Useful stackexchange link too.
I will then contact Stachethemes if it needs something more from them.
I will share the code here if we get it to work.
You're welcome