Astra_Ext_Advanced_Headers_Meta::generate_logo_by_width( int $custom_logo_id )
Generate logo image by its width.
Description
Parameters
- $custom_logo_id
-
(int) (Required) Logo id.
Source
File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-meta.php
public static function generate_logo_by_width( $custom_logo_id ) { if ( $custom_logo_id ) { add_filter( 'intermediate_image_sizes_advanced', 'Astra_Ext_Advanced_Headers_Meta::logo_image_sizes', 10, 2 ); $image = get_post( $custom_logo_id ); if ( $image ) { $fullsizepath = get_attached_file( $image->ID ); if ( false !== $fullsizepath || file_exists( $fullsizepath ) ) { $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath ); if ( ! is_wp_error( $metadata ) && ! empty( $metadata ) ) { wp_update_attachment_metadata( $image->ID, $metadata ); } } } remove_filter( 'intermediate_image_sizes_advanced', 'Astra_Ext_Advanced_Headers_Meta::logo_image_sizes', 10 ); } }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |