Home › Forums › Calendar Products › Events Calendar PRO › Faster way to assign featured image to repeating events?
- This topic has 4 replies, 2 voices, and was last updated 11 years, 4 months ago by
Brook.
-
AuthorPosts
-
December 3, 2014 at 11:08 am #906493
Peppermint Soda
ParticipantI just imported from a .csv file over 400 different events whereas 20 are offered repeatedly throughout the year. I need to assign a Featured image to each event. Is there a faster way to do this other than search for like events and then manually attaching the featured image to all 60 or so one at a time before moving onto the next? It is going to take me FOREVER. Your .csv importer can’t import the “Featured Image” field. Perhaps it can be edited at the sql database level?
Note: I have not checked off your diagnostic plugin conflict etc. below as it is a feature of the plugin and not a conflict. Thanks for your help.
December 3, 2014 at 3:20 pm #906831Brook
ParticipantHowdy Peppermint Soda,
That is somethign I personally would like to see added to the CSV importer as well. It would be a cool feature!
This would be neigh impossible to do purely through SQL. Our plugin really has little to do with feature images. The events a re simple WP Custom Post Type, and so they inherit all of WP’s post functionality including featured images. And that might be the key to solving your problem. If I was do this programatically I think the WP API will make it rather easy. First I would copy and rename /the-events-calendar/lib/io/csv/, then maybe unhook the original from running be doing remove_action on the hooks inside of ecp-events-importer.php. Renaming the original will be a a bit involed though, as you will have to rename the classes and global functions. So, if you’re not interested in that you could just modify the current plugin with knowledge of the fact that you can no longer update it without losing your changes. Although, if you fork the plugin you can virtually mitigate that risk.
Now I would add an extra field inside of classes/TribeEventsImporter_FileImporter_Events.php and the column mapper, and possibly a few other areas. That will be the image field. In TribeEventsImporter_FileImporter_Events.php we can now handle that field. I think this function media_handle_sideload(). Will be perfect for your needs. All you need is for your images to be accessible via URL from the server, possible by uploading them to the internet. Now in your extra field you can pass those URLs to this function. Then set those images as the features image for each post.
Clearly this is an involved modification, and will require a fair bit of knowledge of how the WP API works and handles media uploads/featured images. But, depending on how many images you are doing the time to develop might be less than the time it takes to upload each manually. Furthermore, writing this is in my opinion a whole lot more fun than a repetitive upload task.
Does that help get you going in the right direction? Or does it possibly sound too involved?
– Brook
December 3, 2014 at 3:21 pm #906837Brook
ParticipantPS. While it usually takes an understandable while from request to implementation, this would make a great feature request.
December 12, 2014 at 8:21 am #916451Peppermint Soda
ParticipantWell, I would say that is way too involved for me. I would want to have dev. support on this. I’ll add it in as a feature request. At any rate, thank you for the lengthy and thorough response. I will save this for reference in case I decide to take that route.
December 16, 2014 at 7:03 am #919786Brook
ParticipantI understand that. I wish it was easier. That is a feature I too would like to see in the CSV importer. But, unfortunately there has not been enough demand for it. At least yet. We are currently working on adding a number of features to the calendar, many of them far more popular with our users. But if you do make a feature request hopefully it will gain popularity in the mean time. Thanks peppermint!
– Brook
-
AuthorPosts
- The topic ‘Faster way to assign featured image to repeating events?’ is closed to new replies.
