-1

I wanted to include the featured image to the blog posts' preview on the front page, however either I get the entire image with the options of cropping some of it off or I can't have any image on my preview at all.

Here are screenshots with and without the image on the preview: http://imgur.com/a/3nqcb

The options I have to control it's size all just cut parts of it out. What I wanted was a small thumbnail, preferably to the left of the post's preview. I have already tried using the featured image as a thumbnail, in the post, but all to no avail.

So can anyone help me on this one?

The theme I'm using is Tesseract and this is the link: http://topnewsreporters.com/

  • 2
    question of the type "my code do not work as I wish" without showing the code in question are mostly pointless – Mark Kaplun Mar 26 '17 at 8:28
1

You can edit the default image sizes that WordPress creates by going to Settings -> Media in your WordPress dashboard and specifying image sizes. However, this will change the default image sizes and will affect all images across your site.

Another option is to edit the template file that is displaying your blog (likely home.php or index.php) using get_the_post_thumbnail()

You can use get_the_post_thumbnail() to insert the post's featured image while specifying a size.

For example: <?php get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>

get_the_post_thumbnail accepts the following image sizes: post-thumbnail, thumbnail, small, medium, and large.

Links to the docs:

get_the_post_thumbnail();

get_the_ID();

  • Thank you for your help! It almost worked. Basically now I have that the image appears, but it's under the title and initial description instead of to the left. I tried messing around with some of the css, but couldn't find anything that would change it. Would you by any chance know where to do that too? – theJuls Jan 23 '16 at 15:09
  • Make sure you are including get_the_post_thumbnail() before the title and description. The function used to get title is usually the_title(), and the function for the description is likely the_content() or the_excerpt(). Then you can use CSS to add float: left; to the image and the containing div for the title and description which should place them side by side with the image on the left. Note: you may have to define a width to make them appear properly. – Jacob McKinney Jan 23 '16 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.