Import Autotag

Home Forums Calendar Products Event Aggregator Import Autotag

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1166331
    Damon Padovano
    Participant

    Hello,

    We are working on a project that needs to import Google calendar events. However, we also have features that require the event to have tags. We have searched around an could not find anything that could automatically tag the events as they are imported. We were wondering if there is any recommended plugin or solution to accomplish this feature.

    Thanks!

    #1166368
    Nico
    Member

    Hi there @oriongroup,

    Thanks for getting in touch with us!

    Can you please let me know a bit more about what you are trying to achieve? Do you need a ‘fixed’ tag for imported events? Or does the tagging needs to be dynamic according to each event content?

    Please let me know about it,
    Best,
    Nico

    #1166373
    Damon Padovano
    Participant

    Hi Nico,

    Thank you for your quick response.

    All we need is a simple fixed tag for each event imported to the site. This way, the events will work with the other features we have on the website.

    #1167179
    Nico
    Member

    Thanks for confirming @oriongroup ๐Ÿ™‚

    Just add the following snippet to your theme’s (or child theme’s) functions.php file:

    /* Tribe, add tag to iCal imported events */
    function tribe_tag_ical_imported ( $post_id, $post, $update ) {

    // bail if the event has not been imported via iCal Importer
    if ( get_post_meta( $post_id, '_EventIcalSource', true ) == '' ) return false;

    // set tag
    wp_set_post_tags( $post_id, 'ical_imported', true );

    }

    add_action( 'save_post_tribe_events', 'tribe_tag_ical_imported', 10, 3 );

    Be sure to change ical_imported for the actual tag you want to use. If it’s more than one tag you can pass various comma separated values or an array.

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

    #1167372
    Damon Padovano
    Participant

    Hi Nico,

    This is exactly what we needed. I just tested it out and it works like a charm.

    Thank you very much for your help.

    #1167391
    Nico
    Member

    Thanks for the heads-up. You are welcome, glad to be of service ๐Ÿ™‚

    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.

    Cheers,
    Nico

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