WordPress.org

Ready to get started?Download WordPress

Forums

excerpt with image (2 posts)

  1. roburdick
    Member
    Posted 4 years ago #

    I am using thematic with a child theme. I have managed to get excerpts to show on my blog page, but wondered if I could get a thumbnail from the post to display as well. I would like to be able to do this using the functions.php

    Thanks in advance

    Rob ;-)

  2. roburdick
    Member
    Posted 4 years ago #

    Think i found a plugin for this problem.

    http://www.cnet.ro/wordpress/thumbnailforexcerpts/

    I also had to modify the content-extensions.php found in library/Extensions of Thematic theme folder. I realise this is not best practise for upgrades, so if anyone could tell me how to do this using my child theme funtions.php i would be very grateful.

    I changed this bit:

    if (is_home() || is_front_page()) {
    		$content = 'excerpt';

    from the original:

    if (is_home() || is_front_page()) {
    		$content = 'full';

    Here is the full code

    //creates the content
    function thematic_content() {
    
    	if (is_home() || is_front_page()) {
    		$content = 'excerpt';
    	} elseif (is_single()) {
    		$content = 'full';
    	} elseif (is_tag()) {
    		$content = 'excerpt';
    	} elseif (is_search()) {
    		$content = 'excerpt';
    	} elseif (is_category()) {
    		$content = 'excerpt';
    	} elseif (is_author()) {
    		$content = 'excerpt';
    	} elseif (is_archive()) {
    		$content = 'excerpt';
    	}
    
    	$content = apply_filters('thematic_content', $content);
    
    	if ( strtolower($content) == 'full' ) {
    		$post = get_the_content(more_text());
    		$post = apply_filters('the_content', $post);
    		$post = str_replace(']]>', ']]>', $post);
    	} elseif ( strtolower($content) == 'excerpt') {
    		$post = get_the_excerpt();
    	} elseif ( strtolower($content) == 'none') {
    	} else {
    		$post = get_the_content(more_text());
    		$post = apply_filters('the_content', $post);
    		$post = str_replace(']]>', ']]>', $post);
    	}
    	echo apply_filters('thematic_post', $post);
    } // end thematic_content

Topic Closed

This topic has been closed to new replies.

About this Topic