Last active
August 29, 2015 13:56
-
-
Save psteinweber/8933338 to your computer and use it in GitHub Desktop.
Register custom images sizes in wordpress functions.php and make them accessible via the media manager. #wordpress #php
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
/* ========================================================================== | |
Register image sizes | |
========================================================================== */ | |
if ( function_exists( 'add_image_size' ) ) { | |
add_image_size( 'blog-featured', 940, 330, true ); // cropped | |
add_image_size( 'testimonial-thumb', 100, 100, false ); // not cropped | |
} | |
add_filter( 'image_size_names_choose', 'my_custom_sizes' ); | |
function my_custom_sizes( $sizes ) { | |
return array_merge( $sizes, array( | |
'testimonial-thumb' => __('Testimonial thumb'), | |
'blog-featured' => __('Blog featured'), | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment