astra_get_site_image_sizes( boolean $add_custom = false )
Return the array of site’s available image size.
Description
Parameters
- $add_custom
-
(boolean) (Optional) Add custom image size.
Default value: false
Return
(array)
Source
File: inc/extras.php
function astra_get_site_image_sizes( $add_custom = false ) { $image_sizes = array( 'thumbnail' => __( 'Thumbnail', 'astra' ), 'medium' => __( 'Medium', 'astra' ), 'medium_large' => __( 'Medium Large', 'astra' ), 'large' => __( 'Large', 'astra' ), 'full' => __( 'Full Size', 'astra' ), ); // Gets the available intermediate image size names on site. $all_sizes = get_intermediate_image_sizes(); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_intermediate_image_sizes_get_intermediate_image_sizes -- Required for image sizes to work. $refactored_sizes = array( 'full' => __( 'Full Size', 'astra' ), ); foreach ( $all_sizes as $size ) { if ( isset( $image_sizes[ $size ] ) ) { $refactored_sizes[ $size ] = $image_sizes[ $size ]; } else { $refactored_sizes[ $size ] = $size; } } /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( $add_custom && defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) { /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $refactored_sizes['custom'] = __( 'Custom', 'astra' ); } return $refactored_sizes; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |