Last active
April 10, 2019 05:12
-
-
Save feliciaceballos/5ec964069028987c6ad17a4326956acc to your computer and use it in GitHub Desktop.
Add custom sizes in WordPress
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 | |
// First we'll add support for featured images | |
add_theme_support( 'post-thumbnails' ); | |
// Then we'll add our 2 custom images | |
add_image_size( 'featured-large', 1600, 400, true ); | |
add_image_size( 'blog-width', 800, 600 ); | |
// And then we'll add the custom size that spans the width of the blog to the Gutenberg image dropdown | |
add_filter( 'image_size_names_choose', 'wpmudev_custom_image_sizes' ); | |
function wpmudev_custom_image_sizes( $sizes ) { | |
return array_merge( $sizes, array( | |
'blog-width' => __( 'Blog Width' ), | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment