Community Forums › Forums › Archived Forums › Design Tips and Tricks › Cannot add continue reading to content post archive
Tagged: post format
- This topic has 8 replies, 4 voices, and was last updated 9 years, 8 months ago by Carlo.
-
AuthorPosts
-
January 5, 2015 at 1:11 pm #136125toddlohenryMember
When I add these lines to the function.php file:
//* Modify the Genesis content limit read more link
add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
return '... [Continue Reading]';add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
return 50; // pull first 50 words
}I get this:
Parse error: syntax error, unexpected $end in /nas/wp/www/staging/vitalworklife/wp-content/themes/executive-pro/functions.php on line 227
http://vitalworklife.staging.wpengine.com/news/blog/January 5, 2015 at 6:20 pm #136144TonyaMemberHi Todd,
If the code is exactly how you have it above, you are missing the closing curly brace } after the function sp_read_more_link().
Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher · I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampJanuary 7, 2015 at 12:50 pm #136298toddlohenryMemberOK. Fair enough. So I went back and added it correctly...
//* Modify the Genesis content limit read more link
add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
return '... [Continue Reading]';
}No results
January 10, 2015 at 1:24 pm #136907toddlohenryMemberCan I get an answer on this please?
January 10, 2015 at 2:16 pm #136911ChristophMemberHi,
the code you are using is to change the read more button when you are using the WordPress More Tag in the WordPress Editor to break a post on your site.
To make it work on Archive pages you can try the following code:
// Add Read More Link to Excerpts add_filter('excerpt_more', 'get_read_more_link'); add_filter( 'the_content_more_link', 'get_read_more_link' ); function get_read_more_link() { return '... <a href="' . get_permalink() . '">[Read More]</a>'; }
Props for this code snippet go to http://wpatch.com/how-to-add-a-read-more-link-to-genesis-child-theme-excerpts/
January 13, 2015 at 2:15 pm #137356toddlohenryMemberIs the blog page an archive page? I need to know how to get [continue reading] to appear on a page of blog post excerpts. This should not be so difficult!
January 13, 2015 at 2:30 pm #137357toddlohenryMemberI copied and pasted the code exactly as you gave it to me. Nothing! See http://screencast.com/t/E6KNzc2yZ5
January 13, 2015 at 3:51 pm #137363ChristophMemberSorry the code didn´t work for you.
Is there a cache to flush on the wp-engine staging site?Ren Ventura just posted a collection of snippets to show/edit the read more link. Maybe one of those will do the trick for you.
January 14, 2015 at 6:18 am #137423CarloMemberHi there. I use similar code on my own site and it works. Try this:
// Add Read More Link to Excerpts add_filter('excerpt_more', 'vwl_get_read_more_link', 20); function vwl_get_read_more_link( $default ) { if ( is_admin() ) return $default; return '… <a href="' . get_permalink() . '">[Continue Reading]</a>'; }
Are you sure you're pasting the code into the right theme?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.