Show HTML formatting in excerpt
-
I managed to solve many things I wanted done with this plugin,but this one about excerpts I am failing.
I tried:
function lt_html_excerpt($text) { // Fakes an excerpt if needed global $post; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace('\]\]\>', ']]>', $text); /*just add all the tags you want to appear in the excerpt -- be sure there are no white spaces in the string of allowed tags */ $text = strip_tags($text,'<p><br><b><a><em><strong>'); /* you can also change the length of the excerpt here, if you want */ $excerpt_length = 55; $words = explode(' ', $text, $excerpt_length + 1); if (count($words)> $excerpt_length) { array_pop($words); array_push($words, '[...]'); $text = implode(' ', $words); } } return $text; }
/* remove the default filter */ remove_filter('get_the_excerpt', 'wp_trim_excerpt'); /* now, add your own filter */ add_filter('get_the_excerpt', 'lt_html_excerpt');
This does not work.
I know that PMPRO uses wp_trim_excerpt with priority 5, if I am right.
I am not sure how to accomplish this, I need it only insidethe_content
, which means only in posts, not categories, archives, or elsewhere.I want that paragraph which shows be formatted as in the full post.
For this, when someone gets a peek at an excerpt he or she would think that behind a paywall is such non-formated bad text, which will cause many people to bounce off this.I can not use more tags, it does not work in some themes I tried, and I have many posts I don’t have time to go through each and add this tag anyway.
I think this should be offered inside the plugin by default, excerpts should be formatted.
Maybe you have such a thing offered with the premium version, no idea about that, but it would be fair if we have this in the free version.
I mean, if we earn, and we will with nice lead-in text, more than an ugly excerpt block, we can buy premium add-ons and support you.
- The topic ‘Show HTML formatting in excerpt’ is closed to new replies.