Created
May 24, 2017 15:55
-
-
Save MikeiLL/f3e4b916a7fd1332451a44263af52feb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * Add & remove image sizes from the "Image Sizes" panel | |
| * | |
| * @since 1.0.0 | |
| * source: https://wpexplorer-themes.com/total/snippets/addremove-image-sizes/ | |
| */ | |
| public static function cpt_image_sizes( $sizes ) { | |
| // Remove "blog_post_full" image size | |
| unset( $sizes['blog_post_full'] ); | |
| // Add new image size "my_image_sizes" | |
| $sizes['cpt_image_size'] = array( | |
| 'label' => __( 'Image sizes for Slider Entry displays', 'wpex' ), // Label | |
| 'width' => 'cpt_image_size_width', // id for theme_mod width | |
| 'height' => 'cpt_image_size_height', // id for theme_mod height | |
| 'crop' => 'cpt_image_size_crop', // id for theme_mod crop | |
| ); | |
| // Add new image size "my_image_sizes" | |
| $sizes['services_archive'] = array( | |
| 'label' => __( 'Image sizes for Archive Entry displays', 'wpex' ), // Label | |
| 'width' => 'archive_image_size_width', // id for theme_mod width | |
| 'height' => 'archive_image_size_height', // id for theme_mod height | |
| 'crop' => 'archive_image_size_crop', // id for theme_mod crop | |
| ); | |
| // Return sizes | |
| return $sizes; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment