Created
December 14, 2021 04:14
-
-
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
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
<?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