• I am developing a site for somebody which has a blog page with several sample blog posts on at present, and on their home page i have added a recent blog posts box to display the latest 2 posts from category ID 2.
    I am using the_excerpt to get these which adds the continue reading link after so many words.
    Problem is, on the sample blog posts I have added a 125px by 125px image which is displaying fine in the blog page but not on the home page, i want it to display as a thumbnail on the home page, say 75px by 75px.
    Is it because I am using the_excerpt and if I must use the_content then how do I keep the continue reading link?
    Thanks

Viewing 1 replies (of 1 total)
  • M

    (@metacomcreative)

    It sounds like you are trying to display the Featured Image along with your excerpts. You can use the_post_thumbnail to do that.

    You can use add_image_size to create an additional size for your thumbnail (i.e., 75x75px). Check to make sure your theme supports it, and then you can add something like:

    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'excerpt-thumb', 75, 75, true ); // Crop to 75 x 75px
    }

    Then, you can use that new size when you grab the Featured Image. For example, your final result may look something like the following:

    <?php
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail('excerpt-thumb');
    }
    ?>
    <?php the_excerpt(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Images not showing’ is closed to new replies.