Skip to content

Instantly share code, notes, and snippets.

@WebEndevSnippets
Created October 3, 2018 17:33
Show Gist options
  • Save WebEndevSnippets/766f49b59a6e200d5aefff6d16722f3d to your computer and use it in GitHub Desktop.
Save WebEndevSnippets/766f49b59a6e200d5aefff6d16722f3d to your computer and use it in GitHub Desktop.
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' ),
) );
}
@hduckyman
Copy link

I am learning to make a website about five nights at freddy's games and I love you so much for sharing a lot of code for me to make my website the best. I thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment