Custom thumbnail size not showing for custom post type
-
I have a custom post type ‘rotator’ for a slideshow on a particular page.
I’m using Featured Image for the slideshow and have enabled this in init.php (I’m using the Roots theme) and added a new size called ‘slider’.
add_theme_support( 'post-thumbnails'); set_post_thumbnail_size(150, 150, false); add_image_size('slider', 880, 280, true);
Then I have a new WP_query to pull in the thumbnail and some custom meta (such as headers and things for the slideshow) as follows:
` <?php
$rQuery = new WP_Query( array( ‘post_type’ => ‘base_rotator’ ) );
while ( $rQuery->have_posts() ) : $rQuery->the_post();
echo ‘<li>’;
the_post_thumbnail($post->ID, ‘slider’);
$main_header = get_post_meta($post->ID, ‘main_header’, true);
if (!empty($main_header)) :
echo ‘<h2>’.$main_header.'</h2>’;
endif;
$sub_header = get_post_meta($post->ID, ‘sub_header’, true);
if (!empty($sub_header)) :
echo ‘<h3>’.$sub_header.'</h3>’;
endif;
$cta_title = get_post_meta($post->ID, ‘cta-title’, true);
$cta_link = get_post_meta($post->ID, ‘cta_link’, true);
if (!empty($cta_link)) :
echo ‘<a href=”‘.$cta_link.'” class=cta>’.$cta_title.'</a>’;
endif;
echo ‘</li>’;
endwhile;
?>`Everything is working except that the image that is displayed is actually the fullsize version of the image, not the ‘slider’ thumbnail. I tried moving the size to pull in the regular 150×150 thumbnail but this also didn’t work.
Any help much appreciated.
- The topic ‘Custom thumbnail size not showing for custom post type’ is closed to new replies.