Created
March 21, 2012 21:00
-
-
Save heroheman/2152799 to your computer and use it in GitHub Desktop.
Wordpress: Add Custom Image Size
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
//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