Last active
December 21, 2015 00:49
-
-
Save ChrisCree/6222993 to your computer and use it in GitHub Desktop.
Force the Read More link to show on manual excerpts when the Genesis --> Theme settings is set to show post excerpts.
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
<?php | |
// Add Read More button to blog page and archives | |
add_filter( 'excerpt_more', 'wsm_add_excerpt_more' ); | |
add_filter( 'get_the_content_more_link', 'wsm_add_excerpt_more' ); | |
add_filter( 'the_content_more_link', 'wsm_add_excerpt_more' ); | |
function wsm_add_excerpt_more( $more ) { | |
return '<span class="more-link"><a href="' . get_permalink() . '" rel="nofollow">Read More</a></span>'; | |
} | |
// Force Read more on manual excerpts | |
add_filter( 'get_the_excerpt', 'wsm_add_manual_excerpt_more' ); | |
function wsm_add_manual_excerpt_more( $more ) { | |
global $post; | |
// Check for manual excerpts & display if found | |
if ( !empty( $post->post_excerpt ) ) { | |
return $post->post_excerpt . wsm_add_excerpt_more( $more ); | |
} | |
// Just keep rollin' if there are no manual excerpts | |
else { | |
return $more; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment