Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add custom sizes in WordPress
<?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