Skip to content

Instantly share code, notes, and snippets.

@amdrew
Created January 31, 2014 02:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/8725670 to your computer and use it in GitHub Desktop.
Save amdrew/8725670 to your computer and use it in GitHub Desktop.
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