Ulla

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Custom category based on event title #1413806
    Ulla
    Participant

    It works perfectly!

    Thank you so much for your help, Victor.
    You have been off great assistance. Say thanks to the team as well.

    Have a great New Year’s!

    in reply to: Custom category based on event title #1413138
    Ulla
    Participant

    This reply is private.

    in reply to: Custom category based on event title #1400166
    Ulla
    Participant

    Thank you so much for you help so far Victor!

    I am very close to getting the modification to work, but I have one last hurdle.
    This is what I have so far:

    function add_custom_event_categories( $items, $meta, $activity ) {
    	// Alter the event according to your needs
    	foreach ($items as $item) {	
    		if (strpos($item, ‘golf’) !== false) {
    			wp_set_object_terms( 6972, 'golftime', 'tribe_events_cat');
    		}
    		if (strpos($item, ‘beach’) !== false) {
    			wp_set_object_terms( 6415, 'beachtime', 'tribe_events_cat');
    		}
    	}
    	// Unhook
    	remove_action( 'tribe_aggregator_after_insert_posts', 'add_custom_event_categories' );
    }
    add_action( 'tribe_aggregator_after_insert_posts', 'add_custom_event_categories', 3);

    It all works, it checks every entry that is getting imported/updated and if some part of the title matches the text it runs the wp_set_object_terms and adds the categories to the posts.

    The last thing I would need help with is switching out whatever post-id I have hard-coded above (6972 and 6415) into whatever post is currently running through the loop. I have tried using $item and get_id(), but I can’t seem to get it working. The abstract.php you linked helped me out, but I’m still a novice in php and I can’t figure out how the event_id is stored.
    How do I extract the event id from the parameters being passed in tribe_aggregator_after_insert_posts?

    Thank you in advance!
    Cheers,
    Ulla

    in reply to: Custom category based on event title #1396542
    Ulla
    Participant

    Thank you for the response.
    I apologize if my question is outside the range of your assistance.

    The thread you linked was very helpful. I am still a bit lost however.
    Using the skeleton Barry provided I was able to modify the imports. However, I can’t figure out how to target the event categories. I looked through the functions archive (https://theeventscalendar.com/functions/) but nothing stands out to me.
    Is there some documentation that you could link that could help me?

    Thank you in advance!

Viewing 4 posts - 1 through 4 (of 4 total)