Community Forums › Forums › Archived Forums › Design Tips and Tricks › Manual excerpts read more link
- This topic has 4 replies, 3 voices, and was last updated 9 years, 2 months ago by NCKTessa.
-
AuthorPosts
-
February 13, 2015 at 10:12 am #140708NCKTessaMember
I use Swank theme and the Genesis blog page template. I’m making changes to the blog page, switching from showing the full posts truncated with the “more” tag, to showing longer manual excerpts. The reason for the change in methodology is to keep from showing a bunch of images that appear before the more tag on the blog page, thus making the page really long and cumbersome for readers to scroll through.
I am pulling my hair out trying to find the code to add a link to the rest of the post at the end of the manual excerpt. I tried probably 5 to 10 snippets in the functions file, all similar, which had no effect. Everyone in the comment threads for most of these articles says it works great, but nothing happens when I paste the code, and one even succeeded in breaking my site.
At the link, the post to look at, for which I have the manual excerpt set up, is “Mediterranean Zucchini Gratin”, about the second post down right now.
I noticed Brad Dalton has a post on this (http://wpsites.net/wordpress-tips/add-a-custom-read-more-link-after-hand-crafted-manually-added-excerpts/) for paid members, but a free solution would be very much appreciated…apparently this isn’t as simple as I hoped!
http://www.naturalcomfortkitchen.com/blog/February 13, 2015 at 5:42 pm #140792neilgeeMemberYou can try:
//Read More Button For Excerpt function themeprefix_excerpt_read_more_link( $output ) { global $post; return $output . ' <a href="' . get_permalink( $post->ID ) . '" class="more-link" title="Read More">Read More</a>'; } add_filter( 'the_excerpt', 'themeprefix_excerpt_read_more_link' );
http://wpbeaches.com/force-read-link-excerpts-wordpress/
Neil Gee
WP Beaches
Coolest GuidesFebruary 17, 2015 at 11:33 am #141116NCKTessaMemberThank you! That worked.
For the past excerpts that are generating based on word count, I still see [...]. It isn't actually clickable. Is there any way, while keeping the code I just added, to remove the non-functional link from the automatic excerpts? I'm probably not going to go back and convert everything to manual excerpts immediately, but am going for a consistent appearance on the blog page.
February 18, 2015 at 6:54 am #141188WisdmLabsMemberI had a similar issue. When i modified my code for showing a 'Read More' for automatic as well as manual excerpts, i could still see [...] for automatic excerpts. I solved it using 'excerpt_more' filter and returning a empty string:
function custom_excerpt_more($more) { return ''; } add_filter('excerpt_more', 'custom_excerpt_more');
February 18, 2015 at 6:08 pm #141258NCKTessaMemberThanks! That worked. I actually replaced the blank with an ellipsis, sans brackets, since it looked a little weird to just have the sentence straight up cut off in the middle for some excerpts.
-
AuthorPosts
- The topic ‘Manual excerpts read more link’ is closed to new replies.