Last active
May 8, 2016 17:12
-
-
Save kronda/00e47a86bc88b6fbf9a2a361a6457786 to your computer and use it in GitHub Desktop.
Add this to functions php to create image size hints with difference sizes for different post types From https://premium.wpmudev.org/blog/never-forget-your-featured-image-dimensions/
This file contains hidden or 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
/* Featured Image Size Hints */ | |
function karvldigital_image_size_html($content =''){ | |
global $post_ID; | |
$post_type = get_post_type($post_ID); | |
if ( ! ( post_type_supports( $post_type, 'thumbnail' ) | |
&& current_theme_supports( 'post-thumbnails', $post_type ) ) ) | |
return $content; | |
switch($post_type) { | |
case 'post' : $dim = ' (440w × 300h)'; break; | |
case 'page' : $dim = ' (600w × 200h)'; break; | |
case 'testimonials' : $dim = ' (250w × 250h)'; break; | |
default : $dim =''; | |
} | |
$content = str_replace(esc_attr__( 'Set featured image' ), esc_attr__( 'Set featured image' ) . $dim, $content); | |
return $content; | |
} | |
add_filter( 'admin_post_thumbnail_html', 'karveldigital_image_size_html', 9999, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment