Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My site is basically a Pinterest style product catalogue with atleast one image per post.

I upload large images, thumbnails of which are automatically generated by wordpress BUT the website has been loading really slow because the_content tag by default uses the largest thumbnail image that I choose from the "media" tab while creating the post.

Is there any way to use the smaller thumbnail but link to the larger thumbnail on click?

edited to add: I use the Pinboard theme.

I appended the following in functions.php:

add_theme_support('post-thumbnails');
set_post_thumbnail_size(280, 800);

and this in loop.php:

if ( has_post_thumbnail() ) {
    the_post_thumbnail(); 
} else {
    echo("-");
}

but it shows the else part on the website, so I assume it isn't finding the image used?

Thanks!

share|improve this question
    
Can you give more info please? Is it a custom theme you use? Have you tried making the default generated thumbnails smaller (to your needs) under settings->media? Have you tried a lightbox plugin? What do you mean by "smaller/larger thumbnail"? The default sizes are: thumb/medium/large. –  marikamitsos Jan 6 '13 at 8:24
    
@marikamitsos Sure, I edited the description –  Nimbuz Jan 6 '13 at 8:28
    
@marikamitsos I upload images from the media tab, then create a post and attach the uploaded image. Although the image shows fine on the homepage but it shows the full version although I can see under uploads that wordpress has generated all sizes. –  Nimbuz Jan 6 '13 at 8:30

2 Answers 2

I suspect you may be unclear about the code and features you are referring to and therefore about what you are asking. If you are trying to change the size of the thumbnail for an image you are inserting in the content area then you would change this in the Settings under Media as marikamitsos mentioned.

Insert the image into the content area by clicking 'Add Media', selecting the image, then selecting 'Media File' from the 'Link To' drop down and 'Thumbnail' from the 'Size' dropdown as shown below. This will allow you to display the thumbnail while linking to the full size image. Also this is the thumbnail size that will reflect what you have set in the Settings under Media.

Inserting a thumbnail while linking to the full size image.

Now if you are trying to insert a 'Featured Image' as your code implies then you need to click 'Set Featured Image' from the Featured Image meta box as shown below.

Set featured image.

The size of the featured image that is displayed can then be changed as you have done in you original code above but rather than add what you did to your functions.php I would suggest simply adding the_post_thumbnail('thumbnail'); to your loop.php. This will again use the dimensions you have set in the Media Settings for thumbnails. Please note that the_content does not display the featured image.

I suspect you are seeing the result of your else condition because you may have not actually set the featured image. Please refer to the codex on how to get the post thumbnail linking to the large image size as varun1505 mentioned.

Hope this helps!

share|improve this answer

I think this will help you. It shows how to link to a larger image and display the thumbnail.

Also, if you want to display a smaller image, you can do this

the_post_thumbnail( array(100,100) );

This will generate a thumbnail of size 100px by 100px.

share|improve this answer
    
Tried this, but returns nothing, its still the same. –  Nimbuz Jan 6 '13 at 10:52
    
can you post some code from loop.php? what exactly does loop.php do? –  varun1505 Jan 6 '13 at 15:28
    
well its a huge file but the only relevant part is the_content cause its the tag that displays the featured image on the homepage, and I need that image to be a "thumbnail" instead of the larger one –  Nimbuz Jan 7 '13 at 2:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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