WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found the code on the WP Recipies page to force excerpts on the home page:

function my_excerpts($content = false) {
    // If is the home page, an archive, or search results
if(is_front_page() || is_archive() || is_search()) :
    global $post;
    $content = $post->post_excerpt;

// If an excerpt is set in the Optional Excerpt box
    if($content) :
        $content = apply_filters('the_excerpt', $content);

// If no excerpt is set
    else :
        $content = $post->post_content;
        $excerpt_length = 55;
        $words = explode(' ', $content, $excerpt_length + 1);
        if(count($words) > $excerpt_length) :
            array_push($words, '...');
            $content = implode(' ', $words);
        $content = '<p>' . $content . '</p>';


// Make sure to return the content
return $content;


add_filter('the_content', 'my_excerpts');

But how do I modify that snippet to add a hyperlink to the full post for the "..." part?

share|improve this question
up vote 2 down vote accepted

Replace the last row of code from:

return $content;


return $content.'<a href="'.get_permalink($post->ID).'">Read More...</a>';
share|improve this answer
hi there, thanks for the tip. Is there a way I can have this be right at the end of the excerpt? Right now it shows it after a line break. Example: startupjobsla.com I am using the Coraline template by Automattic. – noel saw Mar 15 '11 at 5:28
simply add a class to the link and style it with CSS – Bainternet Mar 15 '11 at 13:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.