-
-
Save anythinggraphic/6c0f7f650bad0f3f31915709cf1ba064 to your computer and use it in GitHub Desktop.
Add customized 'read more' links to hand crafted 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
<?php | |
/* Add "Read More" link to hand-crafted excerpts | |
----------------------------------------------------------------------------------------*/ | |
add_filter('get_the_excerpt', 'ag_manual_excerpt_read_more_link'); | |
function ag_manual_excerpt_read_more_link($excerpt) { | |
$excerpt_more = ''; | |
if (has_excerpt() && ! is_attachment() && get_post_type() == 'post') { | |
$excerpt_more = ' <a href="' . get_permalink() . '">[Continue reading] <span class="screen-reader-text">' . get_the_title() . '</span></a>'; | |
} | |
return $excerpt . $excerpt_more; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment