-
AuthorPosts
-
August 13, 2015 at 10:29 pm #358807
Two goals:
1) ACCOMPLISHED: On blog index page, show at least some of the text content from the blog post that was created in Cornerstone. Achieved by changing blog customization to “Full Post Content on Index”.
2) On the blog index page, DO NOT show the entire blog entry, instead show an excerpt followed by “Read More” link to the original blog post.
I have not yet figured out #2. Can you help?
I’ll post my login credentials next in case you need to get to the site.
August 13, 2015 at 10:33 pm #358809This reply has been marked as private.August 14, 2015 at 12:21 am #358897Hello There,
Thanks for the admin credentials.
I am a little confused on your number #1.
For number 2.) You want this page:http://www.fatman365.com/blog/ to show just excerpt of the post and readmore and not the entire content. First, we have to set Full Post Content on Index via Appearance > Customizer > Blog > Full Post Content on Index to OFF. Post created using Cornerstone doesn’t show a normal excerpt. We have to set a manual excerpt. Click screen options on the upper right part of the post edit page then click Excerpts. It is because wordpress will strip out all html and shortcodes from the content and the content when using Cornerstone is wrapped inside a shortcode. So it stripped everything out. To generate automatic excerpt with readmore, it should be plain text which will not work with Cornerstone content. Your option is to use the normal editor to generate automatic excerpt and read more or use Cornerstone but set a manual excerpt. Then we have to add the following custom function in your child theme functions.php to generate readmore link for manual excerpts://Read More Button For Excerpt function themprefix_excerpt_read_more_link($output) { global $post; return empty( $output ) ? $output : $output . ' <a href="' . get_permalink($post->ID) . '" class="more-link" title="Read More">Read More</a>'; } add_filter( 'the_excerpt', 'themprefix_excerpt_read_more_link' );
Hope this helps.
August 14, 2015 at 12:20 pm #359290Thank you!!! All working now, as hoped.
August 14, 2015 at 3:19 pm #359419You are most welcome 🙂 .
October 24, 2015 at 8:57 pm #638364Hi Themeco Staff,
Glad I found this post, as I like to do my editing in Cornerstone.
Just a couple of questions, though:
1. The ‘read more’ text that is displayed in the excerpt is in all caps. How can I change it to sentence case?
2. How can I remove the READ MORE link from the excerpt of really short blogs, where there would be no more content to view?I’ve attached a screenshot with notes so you can get a better idea of what I mean. (I’m using the ICON stack, if that also helps.)
Many thanks,
Mel
October 24, 2015 at 11:06 pm #638456Hi Mel,
You can try this one replacing the code above.
//Read More Button For Excerpt function themprefix_excerpt_read_more_link($output) { global $post; return str_word_count( $output, 0 ) <= 10 ? $output : $output . ' <a href="' . get_permalink($post->ID) . '" class="more-link" title="Read More">Read More</a>'; } add_filter( 'the_excerpt', 'themprefix_excerpt_read_more_link' );
This
str_word_count( $output, 0 ) <= 10
means skip adding read me if the content has only 10 words.As for read me styling, add this css at Admin > Appearance > Customizer > Custom > CSS.
.more-link { text-transform: lowercase; }
Cheers!
October 25, 2015 at 3:07 am #638603Hi Themeco Staff,
Worked like a charm!
Thank you very much for your help 🙂
Mel
October 25, 2015 at 3:12 am #638620Hello Mel,
You’re welcome! We are just glad we were able to help you out.
Thanks for letting us know that it has worked for you.Cheers.
-
AuthorPosts