Embedded HTML

This topic contains 4 replies, has 2 voices, and was last updated by  Glenn Menzie 7 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23488

    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
    #23493

    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
    #23495

    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
    #23515

    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
    #23537

    Thanks again Stephen…just removed

    'preg' . .

    Take care.

    Glenn

    Glenn Menzie
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.