Hi -- I'm trying to create a job to import events. Two questions
1) Availability of CSV scheduled jobs
Ideally it would be on CSV as it's easier for my exporting pipeline, but I don't see the option for scheduling a job to pick up a CSV -- only ICS. Can you please confirm if CSV is not currently supported?
2) ICS schema
It does look like scheduling a ICS import job is possible, but I don't see anywhere the documentation for the fields. I exported my current events but noticed that fields like 'Image' are not present, to name one. Where can I learn the full schema?
Ok bummer. I might need to create a custom script to inject the events and the images on the WP DB then. Are there any articles / answers written on this that you could point me to?
/** * For all available methods check get_class_methods($event); * or wp-content\plugins\stachethemes_event_calendar\assets\php\o.event.php
*/
$event = new \Stachethemes\Stec\Event_Post();
$event->set_title('Event Title'); $event->set_start_date('2020-01-31 00:00:00'); $event->set_end_date_date('2020-01-31 12:00:00');
/** * 1,2,3,4 are the images IDS number from your WP Media * You will have to upload the images to your WP Media first */ $event->set_images(array(1, 2, 3, 4));
$event->insert_post();
Ah, that's a good idea. This seems like a snippet of code I should only run once, right? (because it lodges the cron job, somewhere). What's the best practice for executing these? Do I just create a random php page and then visit it with the browser, to trigger the php to run server-side?
Place it in your functions.php file and leave it as is. Do not remove it.
Note: this is WP Cron, not real cron job. It should run automatically every hour but if your site is not visited it won't trigger. That's how wp cron works...
The good thing is you can replace wp cron with real one.
Hi -- I'm trying to create a job to import events. Two questions
1) Availability of CSV scheduled jobs
Ideally it would be on CSV as it's easier for my exporting pipeline, but I don't see the option for scheduling a job to pick up a CSV -- only ICS. Can you please confirm if CSV is not currently supported?
2) ICS schema
It does look like scheduling a ICS import job is possible, but I don't see anywhere the documentation for the fields. I exported my current events but noticed that fields like 'Image' are not present, to name one. Where can I learn the full schema?
Thanks!
1) CSV cron jobs are not supported yet.
2) ICS contains following data:
Unfortunately the ICS format does not support images.
Stachethemes Developer
Ok bummer. I might need to create a custom script to inject the events and the images on the WP DB then. Are there any articles / answers written on this that you could point me to?
Here's how you can create event via PHP:
Stachethemes Developer
Additionally what you could do is write your own cron and use the calendar csv importer.
Example:
Stachethemes Developer
Ah, that's a good idea. This seems like a snippet of code I should only run once, right? (because it lodges the cron job, somewhere). What's the best practice for executing these? Do I just create a random php page and then visit it with the browser, to trigger the php to run server-side?
Place it in your functions.php file and leave it as is. Do not remove it.
Note: this is WP Cron, not real cron job. It should run automatically every hour but if your site is not visited it won't trigger. That's how wp cron works...
The good thing is you can replace wp cron with real one.
Example tutorial here.
Stachethemes Developer
Oh, interesting, I see. Thanks!
Since this code isn't working anymore, do you have a different solution?
Thanks