Viewing 1 replies (of 1 total)
  • Thread Starter lcwakeman

    (@lcwakeman)

    So I went ahead and did it.

    // truncate the events table
    	$wpdb->query('TRUNCATE TABLE '.$wpdb->prefix.'aec_event');
    	// Get the published events
    	$posts_array = get_posts(array('post_type' => 'tribe_events', 'numberposts' => 1000, 'order' => 'ASC'));
    	foreach ($posts_array as $posts) {
    		$record = array();	// prevent possible nasty issues
    		// sace the post data
    		$record['title'] = $posts->post_title;
    		$record['description'] = $posts->post_content;
    		$record['user_id'] = $posts->post_author;
    		// get the post custom data
    		$custom = get_post_custom($posts->ID);
    		// save the custom data
    		$record['start'] = $custom['_EventStartDate']['0'];
    		$record['end'] = $custom['_EventEndDate']['0'];
    		$record['allDay'] = $custom['_EventAllDay']['0'];
    		$record['repeat_freq'] = 0;
    		$record['repeat_int'] = 0;
    		$record['category_id'] = 1;
    		$record['repeat_end'] = substr($custom['_EventEndDate']['0'], 0, stripos($custom['_EventEndDate']['0'], ' '));
    		// get the venue custom data
    		$venuecustom = get_post_custom($custom['_EventVenueID']['0']);
    		// save the venue custom data
    		$record['venue'] = $venuecustom['_VenueVenue']['0'];
    		$record['address'] = $venuecustom['_VenueAddress']['0'];
    		$record['city'] = $venuecustom['_VenueCity']['0'];
    		$record['state'] = $venuecustom['_VenueStateProvince']['0'];
    		$record['zip'] = $venuecustom['_VenueZip']['0'];
    		$record['contact_info'] = $venuecustom['_VenuePhone']['0'];
    		// insert the event
    		$wpdb->insert($wpdb->prefix.'aec_event', $record);
    	}

    Not pretty but it works

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Ajax Event Calendar] Import events from The Events Calendar by Modern Tribe’ is closed to new replies.