• Resolved Roger

    (@erpol53)


    Hi,

    I love your plugin as it’s very configurable and really fits my need. The only thing that’s missing is preserving the html in the displayed content.

    I did try the solution you propose (comment out a function in wppsac-function.php), as described here: https://prnt.sc/i4hJehd_x8OR

    The only problem is that it does indeed keep the html, but it also stops truncating the text at the word count specified in the shortcode. The result is that the complete contents of each post are shown, giving the carousel window the height of the longest post, which is very unesthetic.

    So, is it possible to keep the html, but also to truncate the text at the specified length ?

    You can see the carousel on the homepage of the link I provided. Right now I kept the html filtered, because it’s very ugly otherwise!

    Thank you for your response,
    RP

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ketan Patel

    (@patelketan)

    Hello,

    Thanks for reaching out to us…

    sorry for the inconvenience, this is not possible to html and word length same time so it’s not possible…

    Thread Starter Roger

    (@erpol53)

    Hi,

    Thanks for the quick response. Ok, I understand the problem, it’s because you use the core WP function wp_trim_words (), which both trims the text and cleans the html tags.

    I found a solution though, so I post it here in case someone else has the same problem: In the file “includes/wppsac-function.php”, you need to replace the line:

    $content = wp_trim_words( $content, $word_length, $more );

    by this one:

    $content = force_balance_tags( html_entity_decode( wp_trim_words( htmlentities( wpautop($content) ), $word_length, $more ) ) );

    This will trim the text to the correct word count specified in $word_length, while keeping all the html tags present.

    Best regards,

    RP

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Keep html tags in content’ is closed to new replies.