heroheman
3/21/2012 - 9:00 PM

Wordpress: Add Custom Image Size

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 );  
        } 
    }