Need HTML in Excerpt
-
I like the layout provided by EDD for my digital downloads, but need some simple HTML to be allowed in the excerpt shown for each downloadable item.
I have always used a standard snippet of code, which I’ll paste below, but it doesn’t work in this case (it works elsewhere that WP displays excerpts, just not with my Downloads).
function improved_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) { $text = get_the_content(''); $text = strip_shortcodes( $text ); $text = apply_filters('the_content', $text); $text = str_replace('\]\]\>', ']]>', $text); $text = strip_tags($text, '<b><del><em><small><span><strong>'); $excerpt_length = apply_filters('excerpt_length', 60); $newexcerpt_more = apply_filters('excerpt_more', 'new_excerpt_more'); $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); if ( count($words) > $excerpt_length ) { array_pop($words); $text = implode(' ', $words); $text = $text . $newexcerpt_more; $text = force_balance_tags( $text ); } else { $text = implode(' ', $words); $text = force_balance_tags( $text ); } } return $text; } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'improved_trim_excerpt');
How can I incorporate this code with the EDD plugin so that my excerpts can make use of a few basic styles?
Thanks for any help you can offer!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Need HTML in Excerpt’ is closed to new replies.