Having multiple custom thumbnail sizes on homepage
-
Hey
Can anyone give me some advice on my little annoying problem.
Ok on my homepage I currently have 4 different size div’s for different size posts. You select what size div you want the post to show up as via a custom field when adding/editing a post.
I have used “Custom Field Template” plugin to achieve this. Using it to add a custom field then echoing that as a class in the loop.
Now within that loop there is a <?php the_post_thumbnail(”) ?> tag calling the thumbnail which works but I would like to be able to set the thumbnail size for each different size div.
I have set up the sizes in the functions.php file as
set_post_thumbnail_size( 310, 500); // default size
add_image_size( ‘col1’, 135, 300); // custom size
add_image_size( ‘col3’, 445, 300); // custom size
add_image_size( ‘col4’, 660, 350); // custom sizeand can call each manually by <?php the_post_thumbnail(‘col2’) ?> for example. but cant work out how to do this dynamically. As If the div size is col3 add the col3 image size.”<?php the_post_thumbnail(‘col3’) ?> ”
how can I change the <?php the_post_thumbnail(”) ?> handle depending on what div is used?
hope this makes some sense. thanks for your help people.
- The topic ‘Having multiple custom thumbnail sizes on homepage’ is closed to new replies.