Home › Forums › Calendar Products › Event Aggregator › Hide shortcodes in imported events
- This topic has 5 replies, 2 voices, and was last updated 8 years, 5 months ago by
Ville.
-
AuthorPosts
-
October 9, 2017 at 11:26 am #1361193
Ville
ParticipantHi,
I’m setting up a scheduled iCal import from another WordPress running Events Manager. The import works just fine, but there are shortcodes in the event body and the imported event shows those shortcodes as code (as can be expected). I’d like to remove/hide the [shortcode xyz=”123″] tags because in my calendar they are just junk code.
The regex for removing the shortcodes is not an issue, here’s an example:
https://stackoverflow.com/questions/32418336/php-remove-shortcodes-and-content-in-between-with-regex-patternBut is there a hook in the Event Aggregator that I could plug this code into? I don’t know how to do that. I’d really like to handle that properly and not through some temp file.
regards,
Ville
October 11, 2017 at 7:25 am #1362037Patricia
MemberHey Ville,
Thank you for reaching out to us!
I do want to note that we are fairly limited in how much we can support custom development questions like this, but to help you get started, the files we use to handle imports are located on the-events-calendar/src/Tribe/Importer. I didn’t test it, but perhaps including this regex on File_Importer_Events.php would be a good option. We do have a list of recommended developers who could help you out with the code if you need it.
There are also other (simpler) alternatives to achieve what you want: you can use a plugin like Say What? to replace all occurrences of [shortcode xyz=ā123ā³] with an empty space. If your server is running with WP CLI, you can also set a cron to run a database search-replace every 30 minutes (or any time you want): if you choose this option and you have a linux server, I can help you writing the cron task.
I hope this helps you get started! Let me know if you need anything else and I’ll be happy to assist!
Best Regards,
Patricia
October 30, 2017 at 1:44 pm #1371717Ville
ParticipantHi Patricia,
Thanks for your help. I actually found this plugin which allows regex search and replace without modifying any code:
With that it is trivial to get rid of the imported shortcodes.regards,
Ville
October 30, 2017 at 3:04 pm #1371756Patricia
MemberHi Ville,
That’s awesome! Glad to hear you found another option to get rid of these shortcodes. Thanks for sharing this alternative here š
If you have any other questions at all please feel free to let me know and Iād be happy to help as best I can!
Best regards,
Patricia
November 21, 2017 at 8:36 am #1388153Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Hide shortcodes in imported events’ is closed to new replies.
