Last active
June 1, 2018 16:59
-
-
Save tsquez/54fe129b1a07937454999e11272a602c to your computer and use it in GitHub Desktop.
How to create a “Read More” link in a custom excerpt
This file contains hidden or 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
// Taken from this thread https://wordpress.stackexchange.com/questions/134143/how-can-i-create-a-read-more-link-using-the-excerpt-on-a-static-front-page?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa | |
function new_excerpt_more($more) { | |
return ''; | |
} | |
add_filter('excerpt_more', 'new_excerpt_more', 21 ); | |
function the_excerpt_more_link( $excerpt ){ | |
$post = get_post(); | |
$excerpt .= '... <a href="'. get_permalink($post->ID) . '">continue reading</a>.'; | |
return $excerpt; | |
} | |
add_filter( 'the_excerpt', 'the_excerpt_more_link', 21 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment