ThemeShaper Forums » Thematic

[closed]

Add Thumbnail to Shortened Post

(4 posts)
  • Started 2 years ago by bogh
  • Latest reply from helgatheviking
  • This topic is resolved
  1. bogh
    Member

    Hi, please help me with this one.

    I have found the following code to shorten the excerpts on home page; but if a post has a thumb, the thumb does not show up on home page excerpts.
    Please someone tell me how I can make the thumbs show up on the following code. What code should I add, and where?

    //Shorten the Posts on Home Page and ADD Read More Link
    function childtheme_content($content) {
    	if (is_home() || is_front_page()) {
    	$content= 'excerpt';
    	}
    	return $content;
    }
    add_filter('thematic_content', 'childtheme_content');
    
    function excerpt_ellipse($text) {
    	return str_replace('[...]', '
    	<a href="'.get_permalink().'">Read more</a>', $text);
    }
    add_filter('get_the_excerpt', 'excerpt_ellipse');
    
    function new_excerpt_length($length) {
    	return 20;
    }
    add_filter('excerpt_length', 'new_excerpt_length');

    Thank you a lot.

    Posted 2 years ago #
  2. that all looks good. props for searching the forum to find the appropriate answers.

    assuming that you have selected a featured image, thematic's default mode is to display a thumbnail anywhere there is an excerpt.

    this behavior can be disabled by targeting the following filter:

    apply_filters( 'thematic_post_thumbs', TRUE)

    you can see it is TRUE by default. possible reasons you might not be seeing a thumbnail include filter thematic_post_thumbs to FALSE, not having a featured image set, hiding the featured image with CSS for some reason, or a plugin could be interfering (a bit of a long shot there, but who knows)

    Posted 2 years ago #
  3. bogh
    Member

    Thank you for your reply, you are right, the code is perfect, I just didn't knew that I have to set the image as featured.
    I have lost just a day with that :)) Next time I should pay more attention to simple things, like setting the image as featured.

    Thank you again for your support.
    I wish you a great day!

    Posted 2 years ago #
  4. hello face, meet palm! it happens...

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.