Created
January 15, 2015 11:02
-
-
Save keithdevon/f0c39db2f47aa24610c8 to your computer and use it in GitHub Desktop.
Add read more link to custom excerpts
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
// Add excerpt link to custom excerpts | |
function add_read_more_to_custom_excerpts($excerpt) { | |
// set up the global post variable | |
global $post; | |
if ( !empty( $post->post_excerpt ) ) { | |
$excerpt = $excerpt . '<br/><a href="' . get_permalink() . '">> Read more</a>'; // change this to suit your theme | |
} | |
return $excerpt; | |
} | |
add_filter('get_the_excerpt', 'add_read_more_to_custom_excerpts', 11); // I needed to use priority 11 as I was using another excerpt filter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment