Last active
August 2, 2017 09:36
-
-
Save Hexodus/48ab3f7e707f950c507aa96763b13c4c to your computer and use it in GitHub Desktop.
Add custom images sizes to Wordpress and Admin area. Found solution here: https://havecamerawilltravel.com/photographer/wordpress-resize-thumbnails Place this code in your functions.php (i.e. in your child theme's folder)
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 | |
add_image_size( 'homepage-thumb', 270, 175, false ); //soft crop = resize | |
add_image_size( 'search-thumb', 150, 150, true ); //hard crop | |
add_filter( 'image_size_names_choose', 'my_custom_sizes' ); | |
function my_custom_sizes( $sizes ) { | |
return array_merge( $sizes, array( | |
'homepage-thumb' => __( 'Homepage Thumb' ), | |
'search-thumb' => __( 'Search Thumb' ), | |
) ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment