Custom post thumbnails not using custom sizes
-
Hi,
I have few post thumbnails sizes but it seems like it is not picking them up as I want as it is automatically proportioning by giving its own sizes even tho I have provided fixed sizes in function.php:In my function.php:
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' ); if ( function_exists( 'add_image_size' ) ) { add_image_size($name = 'p1', $width = 260, $height = 85, $crop = TRUE); add_image_size($name = 'p2', $width = 260, $height = 100, $crop = TRUE); add_image_size($name = 'p3', $width = 560, $height = 560, $crop = TRUE); add_image_size($name = 'p4', $width = 260, $height = 460, $crop = TRUE); add_image_size($name = 'p5', $width = 260, $height = 60, $crop = TRUE); add_image_size($name = 'p6', $width = 260, $height = 130, $crop = TRUE); }
In my template:
<?php $img = array(); $img[] = '1'; $img[] = '2'; $img[] = '3'; $img[] = '4'; $img[] = '5'; $img[] = '6'; $max = count($img) -1; $count = rand(0,$max); $dice = p.$img[$count]; ?> <?php the_post_thumbnail("$dice"); ?>
Basically assigning an array so that i get random picked up sizes, yet while the width is correct for all the images, the height it is not been pick up and wp auto set it to proportionally display the image. I need my own sizes to work and crop them.
Any one please? Thanks
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Custom post thumbnails not using custom sizes’ is closed to new replies.