Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UUAB Custom Image Sizes
add_action( 'after_setup_theme', 'wpss_theme_setup' );
/**
* Create custom image sizes
*/
function wpss_theme_setup() {
add_image_size( 'pdfv_thumbnail', 115, 150, true );
add_image_size( 'activity-thumb', 100, 120, true );
add_image_size( 'featured', 590, 250, TRUE );
add_image_size( 'home-slider-crop', 615, 245, TRUE ); //540x?
add_image_size( 'home-slider', 615, 245, FALSE ); //540x?
add_image_size( 'mini', 80, 80, TRUE );
add_image_size( 'unit', 90, 90, TRUE );
add_image_size( 'home-mini', 100, 100, TRUE );
add_image_size( 'portfolio', 202, 140, TRUE );
// add_image_size( 'category-thumb', 300 ); // 300 pixels wide (and unlimited height)
// add_image_size( 'homepage-thumb', 220, 180, true ); // (cropped)
}
add_filter( 'uabb_blog_posts_featured_image_sizes', 'wpss_uuab_image_sizes' );
/**
* Controls the featured image sizes listed in the UUAB Advanced Posts module
*/
function wpss_uuab_image_sizes($size_arr) {
$size_arr = array(
'full' => __( 'Full', 'uabb' ),
'large' => __( 'Large', 'uabb' ),
'medium' => __( 'Medium', 'uabb' ),
'thumbnail' => __( 'Thumbnail', 'uabb' ),
'custom' => __( 'Custom', 'uabb' ),
'activity-thumb' => __( 'Activity Thumb', 'uabb' ),
);
return $size_arr;
}
add_filter( 'image_size_names_choose', 'wpss_custom_image_sizes' );
/**
* Make custom image sizes visible and selectable in the admin
*/
function wpss_custom_image_sizes( $sizes ) {
return array_merge( $sizes, array(
'activity-thumb' => __( 'Activity Thumb' ),
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.