On occasion I have embedded a Tweet or an Instagram posting into an EO event.
On the site on which it is embedded, it appears as expected: a formatted Tweet with image and text, links, etc.
I have three sites which are using the iCal Sync extension to import the events from that original site. The EO calendar on each ‘child’ site (for lack of a better word) then displays events from a given category only.
Invariably the embedded Tweet (or Instagram) is reduced to the link which was pasted into the editor on the original site. Instead of displaying the Tweet (or Instagram) it is a simple line such as https://www.twitter.com/username/239473897978. Where pasting that link into the visual editor on the original site produces the formatted Tweet, when it is imported using the iCal Sync plugin that formatting is lost.
Is there a way to maintain the formatting given to the link by WordPress?
Thanks.
Glenn Menzie
Hi Glenn,
This is a bit of a work-around, but try this snippet (in a utility plug-in / theme’s functions.php):
add_action( 'eventorganiser_ical_property_x-alt-desc', 'my_alter_parsed_content', 10, 3 );
function my_alter_parsed_content( $content, $modifiers, $ical_parser ) {
$ical_parser->current_event['post_content'] = 'preg' . preg_replace(
'/<p>(https?:\/\/[^\s]*)<\/p>/iU',
"\n\\1\n",
$ical_parser->current_event['post_content']
);
}
Stephen Harris
Stephen thank you very much.
It works with one minor exception: the word ‘preg’ (no quotes) precedes the actual content.
But the embedded Tweet (which is no more than a link to the Tweet tossed into the WP editor on the origin site) comes across intact.
Glenn Menzie
My apologies, I had put that there to help check everything was working, but failed to omit when posting it to this thread.
Stephen Harris
Thanks again Stephen…just removed
'preg' .
.
Take care.
Glenn
Glenn Menzie