Home › Forums › Calendar Products › Event Aggregator › Import Autotag
- This topic has 6 replies, 3 voices, and was last updated 9 years, 7 months ago by
Damon Padovano.
-
AuthorPosts
-
September 20, 2016 at 6:10 am #1166331
Damon Padovano
ParticipantHello,
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!
September 20, 2016 at 7:31 am #1166368Nico
MemberHi 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,
NicoSeptember 20, 2016 at 7:45 am #1166373Damon Padovano
ParticipantHi 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.
September 21, 2016 at 4:06 pm #1167179Nico
MemberThanks 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,
NicoSeptember 22, 2016 at 7:42 am #1167372Damon Padovano
ParticipantHi 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.
September 22, 2016 at 8:11 am #1167391Nico
MemberThanks 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 -
AuthorPosts
- The topic ‘Import Autotag’ is closed to new replies.
