Using “Read More” link with custom excerpt

The following functions.php edit (contributed by helgatheviking on the themeshaper forums) allows the use of a “Read More” link with custom excerpts.

My problem is simply this: I’m inept at editing functions.php code, but I’d like to safely remove the “wrap excerpt in p tag” portion of this script.

Read More

How would I do so?

Thanks.

Original script is found here:
http://themeshaper.com/forums/topic/enclosing-excerpt-in-paragraph-tag-038-adding-a-custom-read-more-link

// excerpt read more links and wrap excerpt in p tag
function all_excerpts_get_more_link($post_excerpt) {
    return '<p>' . $post_excerpt . '</p>' . '<p class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue Reading &raquo' . '</a></p>';
}
add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');

Related posts

Leave a Reply

2 comments

  1. This should remove the <p> tags, but leave the styling by replacing the paragraph tag with a <span> class:

    function all_excerpts_get_more_link($post_excerpt) {
        return '' . $post_excerpt . '' . '<span class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue Reading &raquo' . '</span>';
    }
    add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
    
  2. Delete the empty '' it makes no sense on leaving them:

    function all_excerpts_get_more_link($post_excerpt) {
        return $post_excerpt . '<span class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Continue Reading &raquo' . '</span>';
    }
    add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');