Created
March 29, 2011 18:30
-
-
Save gfscott/892944 to your computer and use it in GitHub Desktop.
Wordpress's default the_excerpt() function includes no link at the end, just [...]. This snippet adds a "Read More" permalink to the end of the excerpt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Add to functions.php of Wordpress theme. This function will add | |
<a href="[permalink]" class="readmore">More »</a> | |
at the end of the excerpt. | |
*/ | |
function new_excerpt_more($more) { | |
return '... <a href="'. get_permalink($post->ID) . '" class="readmore">' . 'More »' . '</a>'; | |
} | |
add_filter('excerpt_more', 'new_excerpt_more'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment