Saturday, March 10, 2012

Replace excerpt ellipsis with post permalink

This is very useful tricks to replace the ellipsis [...] from the excerpt with a permalink to the post in wordpress.

Just paste the code below into your functions.php file in theme folder of wordpress. After saved, this tip will be applied to the wordpress blog.



function replace_excerpt($content) {
       return str_replace('[...]',
               '... <div class="more-link"><a href="'. get_permalink() .'">Continue Reading</a></div>',
               $content
       );
}
add_filter('the_excerpt', 'replace_excerpt');

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off