WordPress.org

Ready to get started?Download WordPress

Forums

Post excerpts to retain HTML mark up (3 posts)

  1. fbbr
    Member
    Posted 1 year ago #

    I need my post excerpts to show the HTML mark up.

    I am using a child theme of TwentyTen. I have tried using this method
    http://bacsoftwareconsulting.com/blog/index.php/wordpress-cat/how-to-preserve-html-tags-in-wordpress-excerpt-without-a-plugin/ without success. The update to the functions.php brings down the site!

    Can anyone help?

    site: http://www.freebetreview.com.au/blog/

  2. s_ha_dum
    Member
    Posted 1 year ago #

    The update to the functions.php brings down the site!

    You probably made a mistake in the syntax.

    Maybe I'm missing it but I don't see anything in that code that will prevent it breaking inside html tags, and counting markup as words. For example, <span class="hello">Hi</span> there.. How many words is that? It should be two, but if you break on spaces it is three-- "<span", "class="hello">Hi</span>", and "there.". See what I mean? And if you happen to have your word count at 1, you'd have a broken tag. I don't see anything to prevent that.

    Also, that function runs wp_trim_excerpt right at the end, which, if you trace it, results in the use of wp_strip_all_tags() which will "Properly strip all HTML tags including script and style". I don't see how that function could work at all.

    Let me see if I can find my function for exactly this purpose. Remind me if I don't get to it.

  3. fbbr
    Member
    Posted 1 year ago #

    Thanks s_ha_dum, any help would be much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic