When you use a Genesis theme that has post formats, you may want to use excerpts for some of the longer post formats on your blog and archive pages. But you may also want to display the full content for other formats, like quotes or links. This tutorial shows you how to add full quotes and links for post formats that use excerpts for longer content.
Set Your Content Archives to Excerpt
- Go to Genesis > Theme Settings
- Find Content Archives Section
- Choose “Select one of the following: Display post excerpts”
- Choose the Featured Image, Image size, and Image alignment, as you prefer
Next View Your Blog Page
You will see that the quotes are truncated, and the links are not only truncated, but simply not there. Ideally, you would want the longer post formats to display an excerpt, but the quotes and links to display the full content.
Add Some Code
Add the following code to your child theme functions.php; this will only work for Genesis themes. This will add full content for those post formats listed in the array, so that you will have full content on quotes and links, as in the first image.
<?php
// Remove line above before using.
// Filter the excerpt on quote post formats.
add_filter( 'get_the_excerpt', 'filter_do_post_quote_format_content' );
function filter_do_post_quote_format_content($excerpt) {
if ( has_post_format( array( 'aside', 'link', 'quote', 'video' ) ) && ( 'excerpts' === genesis_get_option( 'content_archive' ) ) ) {
$excerpt = the_content();
return $excerpt;
} else {
return $excerpt;
}
}
Now you see that the quotes show the full quote, even when it’s a longer one. And the actual link can be clicked right from the blog or archive page. You will probably want to include the full content for aside and video post formats, as well, but you can add as many or as few, as you need for your blog.
Remember that these are all the possible formats to add to the array in the code above.
array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' )
Another Method to Have Full Content for Only Some Post Formats
There is another method to have some posts with full content and some to be limited in length. For this method, you will need to edit your Content Archives settings in Genesis > Theme Settings again.
Set Your Content Archives to Full Content
- Go to Genesis > Theme Settings
- Find Content Archives Section
- Choose “Select one of the following: Display post content”
- Limit content to 0 characters <- Very important
- Choose the Featured Image, Image size, and Image alignment, as you prefer
Now all of the posts on the blog and archive pages will show the full content.
Use the More Link to Limit the Content on Some Post Formats
For the post formats that you want to limit in length, such as your longer standard posts, you can limit the length as you edit, with the More Tag or the Read More.
- Edit the long posts.
- In the editor, choose where to cut off the post.
- Insert the “More Tag” or “Read More”. You can choose it from the Visual Editor.
How are you using post formats? Tell us in the comments.
Leave a Reply