Skip to content

Instantly share code, notes, and snippets.

@joshhartman
Created December 14, 2021 04:14
Show Gist options
  • Save joshhartman/fad2410007f9d0db1538f643656dcd2c to your computer and use it in GitHub Desktop.
Save joshhartman/fad2410007f9d0db1538f643656dcd2c to your computer and use it in GitHub Desktop.
Add a Custom WordPress Image Size and Register for Use with UABB and Other Plugins
<?php
// Add new image size for mini gallery
add_action( 'after_setup_theme', 'custom_theme_setup' );
function custom_theme_setup(){
add_image_size( 'mini-thumb', 75, 75, array( 'center', 'center' ) );
}
// Register image size for plugins to use
add_filter( 'image_size_names_choose', 'custom_image_sizes' );
add_filter( 'uabb_photo_gallery_image_sizes', 'custom_image_sizes' );
function custom_image_sizes( $sizes ) {
return array_merge( $sizes, array(
'mini-thumb' => __( 'Mini Thumb' ),
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment