• datacate

    (@datacate)


    Hi – nice plugin! There are a couple of minor issues I have not been able to sort out.

    One is that links and hashtags don’t render correctly. Here’s some actual text from a LinkedIn post being displayed on a dev website (not visible to public) using your plugin:

    2 weeks left, and the excitement is building! We can’t wait to showcase our latest projects and learn from other accessibility champions. {hashtag|\#|CASI2024} {hashtag|\#|BlueDAG} <a target="_blank" >https://lnkd.in/gvC

    The other issue is that the text above actually flows past the container that holds the plugin shortcode on its right side, so the display of the text is partially cut off along that edge. I’ve tried various CSS for that block, but have not been able to alleviate the issue.

    Screenshot showing both issues here: https://imgur.com/a/3YuTB9J

    TIA

Viewing 1 replies (of 1 total)
  • Thread Starter datacate

    (@datacate)

    In case anyone else needs this, you can fix the rendering issues by editing /plugins/company-posts-for-linkedin/public/class-linkedin-company-posts-public.php as follows:

    1. Add two more regex lines:
    $post_content = preg_replace('!(((f|ht)tp(s)?://)[-a-zA-Zа-яА-Я()0-9@:%_+.~#?&;//=]+)!i', '<a target="_blank" href="$1">$1</a>', $post['content']);

    // above is the existing regex in the file. Add the next two lines immediately below it:

    $post_content = preg_replace('/{hashtag|\\#|/', '#', $post_content);
    $post_content = preg_replace('/}/', '', $post_content);

    2. Remove URL escaping:

    $company_posts .= '<span class="linkedin-title">' .esc_html($post_content) . '</span>';

    // above is the existing line with html escaping of the content. Edit it to remove the esc_html() function:

    $company_posts .= '<span class="linkedin-title">' . $post_content . '</span>';

    This will fix up the display. Hashtags will display as plain text prepended by the ‘#’ symbol, but will not have a link. http/https link URLs will be displayed and linked appropriately.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.