On an overview page, I want to display only the post thumbnails with a link to the article. But the thumbs should have different sizes (5 sizes, alternating). Something like that:
Image 1: thumbsize1
Image 2: thumbsize2
Image 3: thumbsize3
Image 4: thumbsize4
Image 5: thumbsize5
Image 6: thumbsize1
Image 7: thumbsize2
and so on.
I know this code to differ between even and uneven posts:
<?php $i = 1; // Index setzen ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if ($i % 2 == 1 ) {
echo 'CONTENT';
} ?>
<?php if ($i % 2 == 0 ) {
echo 'CONTENT';
}
$i++; // Index um 1 erhoehen
?>
<?php endwhile; ?>
<?php endif; ?>
So how can I change this code to fit my needs?
UPDATE:
That’s my code for now:
<?php
$thumbname = 'thumbsize'.($i%5+1); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( $thumbname ); ?></a>
<?php $i++; // Index um 1 erhoehen
?>
<?php endwhile; ?>
<?php endif; ?>
and in my functions.php:
add_image_size( 'thumbsize2', 300, 350, true );
add_image_size( 'thumbsize3', 750, 350, true );
add_image_size( 'thumbsize4', 400, 350, true );
add_image_size( 'thumbsize5', 300, 350, true );
add_image_size( 'thumbsize6', 350, 350, true );
and so on.
However, the thumbnails have the full upload size.
you can use the following method to decide the name if it has a numerical postfix from 1 to 5.
Consider the Example: