Home › Forums › Calendar Products › Events Calendar PRO › Enable post categories to be used by events
- This topic has 8 replies, 4 voices, and was last updated 10 years, 10 months ago by
Support Droid.
-
AuthorPosts
-
January 12, 2012 at 12:15 am #13252
Nicholas
MemberHi,
How can I enable the post categories to be used by events?For example, I have Event Categories of meetings, workshops and task groups. However, I want these events to be categorised by the post categories of clinical services, support services, healthcare environment etc as well.
The reason for this is because the event categories represent the types of events, and the post categories represent the subjects dealt with at the events. As such, all content on the site is represented by subject categories, so if someone searched for clinical services, they may see results that include posts, custom post types as well as events.
Thank you
January 12, 2012 at 9:36 am #13265Rob
MemberHey Nicholas. Thanks for the note here. Not sure what this would entail, but it’s certainly a legitimate question. While it’s outside my area of expertise, let me see if our developer Jonah has any suggestions.
January 12, 2012 at 12:17 pm #13285Jonah
ParticipantHi Nicholas, you should be able to use the following code added to your functions.php file:
function run_init() {
register_post_type( 'tribe_events', array(
'taxonomies' => array('category', 'post_tag') // this is IMPORTANT
));
}
add_action('init','run_init');
January 13, 2012 at 12:35 am #13318Nicholas
MemberHi Jonah and Rob,
I tried what you suggested, but it seemed to overrun the event setup. Since the Events disappeared from the WP menu in the admin area.
I then had a look around the codex and I found this page: http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type
I tried this and it seems to work since I can now select post categories for the events. Now I just need to display the categories via the event template and it should be good to go.
Will update if I run into any issues.Thank you for the help!
January 13, 2012 at 8:49 am #13332Rob
MemberExcellent to hear you got this figured out one way or another, Nicholas. Assuming you’re set here (though let me know if not). Otherwise if you need anything else or have any other questions, let us know…we’ll be happy to do what we can.
January 13, 2012 at 8:56 am #13335Jonah
ParticipantHi Nicholas, yeah I was a little worried it might affect things that way. That function you found should work fine and if you wanted to use it for both categories and tags you just call it twice like so:
register_taxonomy_for_object_type('category', 'tribe_events');
register_taxonomy_for_object_type('post_tag', 'tribe_events');
Sounds like you already figured it out though?
January 18, 2012 at 4:41 am #13560Nicholas
MemberHi Jonah,
Thanks, I have indeed used that method instead.
January 18, 2012 at 7:52 am #13570Rob
MemberAwesome! So it sounds like you’re set here, right Nicholas? Let us know if not 🙂
July 3, 2015 at 5:00 pm #975318Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Enable post categories to be used by events’ is closed to new replies.
