Astra_Ext_Advanced_Headers_Markup::adv_replace_header_logo_attr( array $attr, object $attachment, sting $size )
Replace header logo.
Description
Parameters
- $attr
-
(array) (Required) Image.
- $attachment
-
(object) (Required) Image obj.
- $size
-
(sting) (Required) Size name.
Return
(array) Image attr.
Source
File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-markup.php
public function adv_replace_header_logo_attr( $attr, $attachment, $size ) { $custom_logo_id = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'logo-id' ); if ( $custom_logo_id == $attachment->ID ) { $attach_data = array(); $attach_data = wp_get_attachment_image_src( $attachment->ID, 'ast-adv-header-logo-size' ); if ( isset( $attach_data[0] ) ) { $attr['src'] = $attach_data[0]; } $file_type = wp_check_filetype( $attr['src'] ); $file_extension = $file_type['ext']; if ( 'svg' == $file_extension ) { $attr['width'] = '100%'; $attr['height'] = '100%'; $attr['class'] = 'astra-logo-svg'; } $diff_retina_logo = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'diff-header-retina-logo' ); if ( 'enabled' === $diff_retina_logo ) { $custom_logo = $attr['src']; $retina_logo = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'retina-logo-url' ); $attr['srcset'] = ''; if ( '' !== $retina_logo ) { if ( astra_check_is_ie() ) { // Replace header logo url to retina logo url. $attr['src'] = $retina_logo; } $attr['srcset'] = $custom_logo . ' 1x, ' . $retina_logo . ' 2x'; } } } return $attr; }
Expand full source code Collapse full source code View on Trac