Enable post categories to be used by events

Home Forums Calendar Products Events Calendar PRO Enable post categories to be used by events

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #13252
    Nicholas
    Member

    Hi,
    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

    #13265
    Rob
    Member

    Hey 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.

    #13285
    Jonah
    Participant

    Hi 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');

    #13318
    Nicholas
    Member

    Hi 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!

    #13332
    Rob
    Member

    Excellent 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.

    #13335
    Jonah
    Participant

    Hi 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?

    #13560
    Nicholas
    Member

    Hi Jonah,

    Thanks, I have indeed used that method instead.

    #13570
    Rob
    Member

    Awesome! So it sounds like you’re set here, right Nicholas? Let us know if not 🙂

    #975318
    Support Droid
    Keymaster

    This 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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Enable post categories to be used by events’ is closed to new replies.