Last active
February 20, 2019 10:14
-
-
Save Asok17/6533a2544463887a41ebb040c40a817c to your computer and use it in GitHub Desktop.
StyleBlog Plus - Read More
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
/** | |
* Filter to alter excerpt more text | |
*/ | |
if( !function_exists( 'styleblog_plus_excerpt_more' ) ) : | |
/* | |
* Excerpt More | |
*/ | |
function styleblog_plus_excerpt_more( $more ) { | |
if( is_admin() ) { | |
return $more; | |
} | |
if( is_home() || is_archive() ) { | |
return sprintf( '<a href="%1$s" class="more-link"> %2$s</a>', esc_url( get_permalink( get_the_ID() ) ), esc_html__( 'Read More...', 'styleblog-plus' ) ); | |
} else { | |
return ''; | |
} | |
} | |
endif; | |
add_filter( 'excerpt_more', 'styleblog_plus_excerpt_more' ); |
hi, I tried the code, but not show the "read more".
hi, I tried the code, but not show the "read more".
Hi Joso, It is working for me. Could you replace the whole function code with the above code.
Hi Asok17, I update your code, and I'm sorry but it not work on my site...; I ask: need to add strings of codes in other files? for example to show the category and the author I had to add a string in other files.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want space before the Read More text, you can add
before%2$s
.