Created
January 31, 2014 02:32
-
-
Save amdrew/8725670 to your computer and use it in GitHub Desktop.
Easy Image Gallery - Change the thumbnail size depending on the post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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