Create a gist now

Instantly share code, notes, and snippets.

Easy Image Gallery - Change the thumbnail size depending on the post type
<?php
/**
* Change the thumbnail size depending on the post type
*/
function sumobi_eig_thumbnail_image_size( $image_size ) {
$post_type = get_post_type();
switch ( $post_type ) {
// post's will use the 'medium' size from Settings -> Media
case 'post':
$image_size = 'medium';
break;
// pages's will use the a custom image size added with add_image_size
case 'page':
$image_size = 'custom-image-size';
break;
// all other post types will use the standard 'thumbnail' size from Settings -> Media
default:
$image_size = 'thumbnail';
break;
}
return $image_size;
}
add_filter( 'easy_image_gallery_thumbnail_image_size', 'sumobi_eig_thumbnail_image_size' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment