How to set up excerpts & "Read More!"
This support request was posted in Flatbase by educenter
- educenter January 8, 2015 at 10:53 pm
Dear Juan,
Please see below at our layout – the posts do not contain excerpts with the “Read More” link.
What part of the PHP code governs this? I would like to make it so that all posts are excerpts, and you click on “Read more” to access the full post.
Thanks for your help..
Andrés Villarreal January 9, 2015 at 6:50 pmHi,
You’re gonna need to override the
nice_excerpt()
PHP function by putting the following code right at the end of your functions.php file, or inside a child theme (http://codex.wordpress.org/Child_Themes):function nice_excerpt( $length = 200 ){ $nice_excerpt = substr( get_the_excerpt(), 0, $length ); //truncate excerpt according to $len if ( strlen( $nice_excerpt ) < strlen( get_the_excerpt() ) ) { $nice_excerpt = $nice_excerpt . "..."; } echo "
" . $nice_excerpt . "" . "\n"; if ( strlen( get_the_content() ) > $length ) { echo '' . __( 'Continue reading', 'nicethemes' ) . ''; } }
You can customize the text and markup for the link (printed at the end of the function) to your own needs.
Please let me know how it goes.
Best,
Andrés.
You must be logged in to reply to this topic.