Last active
August 2, 2016 19:32
-
-
Save carasmo/5e9781c3fd37fa9ef29d67f4c8157657 to your computer and use it in GitHub Desktop.
Check for the default <!--more--> and change it but leave custom <!--more Custom Text--> alone
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 | |
// don't use | |
/** ====================================================================================== | |
* | |
* Read More the_content_more_link | |
* Check for the default <!--more--> and change it | |
* but leave custom <!--more Custom Text--> alone | |
* | |
======================================================================================= */ | |
function yourprefix_more_content_more_link( $more_link ) { | |
global $post; | |
if( strstr( $post-> post_content,'<!--more-->') ) { | |
return sprintf( '<a href="%s" class="more-link">%s</a>', get_permalink(), 'Read More' ); | |
} else { | |
return $more_link; | |
} | |
} | |
add_filter( 'the_content_more_link', 'yourprefix_more_content_more_link' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment