Preselected category

Home Forums Calendar Products Events Calendar PRO Preselected category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1148638
    Marlene Hassel
    Participant

    Would it be possible to have a category pre-checked when creating a new event?

    #1148777
    Nico
    Member

    Hi there Marlene,

    Thanks for getting in touch with us!

    This is possible by injecting a javascript snippet in the new event page. Add this code snippet to your theme (or child theme) functions.php file:

    https://gist.github.com/niconerd/b0e8e44c4bc5e396886d4d0af3ea7567

    Just be sure to change the category ID in this selector: #in-tribe_events_cat-7 to match the one in your site.

    Please let me know if this works for you,
    Best,
    Nico

    #1148883
    Marlene Hassel
    Participant

    Yes, that works!
    One more question:
    Is there a function that returns the ID of the current category in the category view?

    #1148973
    Nico
    Member

    Glad to hear it’s working ๐Ÿ™‚

    To get the current taxonomy ID, use the following code:

    $queried_object = get_queried_object();
    $term_id = $queried_object->term_id;

    The above should work for event categories and for all taxonomies!

    Please let me know if that works for you,
    Best,
    Nico

    #1149060
    Marlene Hassel
    Participant

    Perfect! That’s just what I needed.
    Thanks!

    #1149070
    Nico
    Member

    Stocked to hear Marlene ๐Ÿ™‚

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Hope you have a great week,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Preselected category’ is closed to new replies.