I wanted to show a Post Thumbnail and an Excerpt only in the Posts Page (index.php). The excerpt had to include the "Read More" link regardless of its length instead of ellipsis.
I searched the forum and I found bits here and there. What I finally came up with follows. I am no PHP expert, but it might be helpful to anyone looking to achieve the same result. If there's a better way to do this, I'm all ears!
<?php
// ----- SHOW EXCERPT AND THUMBNAIL IN POSTS PAGE-------------------------------
// ------------- * 1) Activate excerpts in posts page:
// ------------- From here: http://forums.themeshaper.com/topic/custom-excerpts#post-11213
function child_content($content) {
if ( is_home() ) { //this is the posts page, see http://codex.wordpress.org/Conditional_Tags
$content = 'excerpt';
}
return $content;
}
add_filter('thematic_content', 'child_content');
// ------------- * 2) Have all excerpts include a "Read More" (regardless of post lenght):
// ------------- (Only excerpts longer than 55 words will get it automatically)
// ------------- From here: http://forums.themeshaper.com/topic/read-more-link-in-manual-excerpt#post-12994
function all_excerpts_get_more_link($post_excerpt) {
return $post_excerpt . '
ID) . '">' . 'Read More...' . '';
}
add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
// ------------- * 3) Remove ellipsis from excerpts longer than 55 words
// ------------- From here: http://forums.themeshaper.com/topic/read-more-link-in-excerpt-redux#post-6323
function excerpt_ellipse($text) {
return str_replace('[...]', '
', $text); }
add_filter('get_the_excerpt', 'excerpt_ellipse');
// ------------- * 4) Activate the post thumbnail feature:
add_theme_support('post-thumbnails');
// ------------- * 5) Add post thumbnail to the posts (index) page:
function my_postheader($postheader) {
if ( is_home() ) {
$postmeta .= the_post_thumbnail();
}
return $postheader;
}
add_filter('thematic_postheader', 'my_postheader');
// ----- END -------------------------------------------------------------------
?>
I hope this helps, or at least gets you started.