I noticed that with Wordpress that they actually don't allow links in their excerpts. I didn't understand why until I actually proceeded to re-write some of the functions. However, now I know why they are not used. It seems that if your excerpt gets cutoff while in an anchor tag that it actually breaks the link and the rest of your page ends up being a link because the anchor tag didn't get closed properly. Has anyone else experienced this and/or know how I could get this fixed?
hello, the wordpress avoid using html in Excerpts to avoid the CSS problems.. but you can use a simple function : function new_trim_excerpt($text) { global $post; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace('\]\]\>', ']]>', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = strip_tags($text, '<a>'); $excerpt_length = 80; $words = explode(' ', $text, $excerpt_length + 1); if (count($words)> $excerpt_length) { array_pop($words); array_push($words, '</a><a>ID) . '">Read the Rest...</a>'); $text = implode(' ', $words); } } return $text; } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'new_trim_excerpt'); Code (markup): You can change the $excerpt_length = 80 to more than that... all depend about your needs... Normally All new themes allow the add of Links on the Excerpt but maybe this function can help the ones they got the same problem like yours!