WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove markup for content? (2 posts)

  1. Digital Raindrops
    Member
    Posted 2 years ago #

    Hi,
    I am working on a free child theme, that will use the Woo Themes Flex Slider in the header, I want to have an option to show text just like the_excerpt, the main slider will have up to 500 characters and the sidebar slider widget 150.

    Here is what I have so far, both sliders working on the same page, if you allow the header slider to slide in the text you will see the issue !\", \' and \":

    Darling put her hand to her heart and cried, \"Oh, why can't you remain like this for ever!\"

    I am cleaning the content with this code to remove the html, like the_excerpt:

    $content = wp_filter_nohtml_kses($content);

    Any ideas on how I can return clean plain text?

    Regards

    David

  2. Digital Raindrops
    Member
    Posted 2 years ago #

    This seems to work fine!

    $content =  nl2br($content);
    $content = strip_tags(wp_kses_no_null(trim($content)),'<br>');

    David

Topic Closed

This topic has been closed to new replies.

About this Topic