mpp_register_media_size ( $args )
Register a new media size.
Description
This function is used to register a new media size.
Parameters
$args
- Name (string) (Required) the name for the media size.
- Width (int) (Required) the width of the image.
- Height (int) (Required ) the height of the image.
- Crop (boolean) (Optional)whether to crop or resize.
- Type (string) (Required ) the type of media.
Returns
Return true if registered successfully.
Examples
The code shows how we can register a new custom image size.
1 2 3 4 5 6 7 8 9 10 11 12 | function mpp_custom_setup_custom_image_size() { mpp_register_media_size( array( 'name' => 'large', 'height' => 1000, //change it 'width' => 1000, 'crop' => false, 'type' => 'default'// can be photo/video/audio/doc, default applies to all media type ) ); } add_action( 'mpp_setup_core', 'mpp_custom_setup_custom_image_size' ); |
In the above code, we have registered a new media size of ratio 1000×1000.
Changelog
- Since 1.0.0
Source
medisapress/core/api/mpp-api.php