Skip to content

Instantly share code, notes, and snippets.

@heroheman
Created March 21, 2012 21:00
Show Gist options
  • Save heroheman/2152799 to your computer and use it in GitHub Desktop.
Save heroheman/2152799 to your computer and use it in GitHub Desktop.
Wordpress: Add Custom Image Size
//custom imagesize
add_action( 'after_setup_theme', 'setup' );
function setup() {
// ...
add_theme_support( 'post-thumbnails' );
// This feature enables post-thumbnail support for a theme
// To enable only for posts:
// add_theme_support( 'post-thumbnails', array( 'post' ) );
// To enable only for posts and custom post types:
// add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) );
// Register a new image size.
add_image_size( 'fullWidthImage', 620, 9999, false );
add_filter( 'image_size_names_choose', 'custom_image_sizes_choose' );
function custom_image_sizes_choose( $sizes ) {
$custom_sizes = array(
'fullWidthImage' => 'Full Width Image'
);
return array_merge( $sizes, $custom_sizes );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment