Astra_Ext_Transparent_Header_Markup::replace_trans_header_attr( array $attr, object $attachment, sting $size )
Replace transparent header logo.
Description
Parameters
- $attr
-
(array) (Required) Image.
- $attachment
-
(object) (Required) Image obj.
- $size
-
(sting) (Required) Size name.
Return
(array) Image attr.
Source
File: inc/addons/transparent-header/classes/class-astra-ext-transparent-header-markup.php
public function replace_trans_header_attr( $attr, $attachment, $size ) { $trans_logo = astra_get_option( 'transparent-header-logo' ); $custom_logo_id = attachment_url_to_postid( $trans_logo ); if ( $custom_logo_id == $attachment->ID ) { $attach_data = array(); if ( ! is_customize_preview() ) { $attach_data = wp_get_attachment_image_src( $attachment->ID, 'ast-transparent-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['class'] = 'astra-logo-svg'; } $diff_retina_logo = astra_get_option( 'different-transparent-retina-logo' ); if ( '1' == $diff_retina_logo ) { $retina_logo = astra_get_option( 'transparent-header-retina-logo' ); $attr['srcset'] = ''; if ( apply_filters( 'astra_transparent_header_retina', true ) && '' !== $retina_logo ) { $cutom_logo = wp_get_attachment_image_src( $custom_logo_id, 'full' ); $cutom_logo_url = $cutom_logo[0]; if ( astra_check_is_ie() ) { // Replace header logo url to retina logo url. $attr['src'] = $retina_logo; } $attr['srcset'] = $cutom_logo_url . ' 1x, ' . $retina_logo . ' 2x'; } } } return $attr; }
Expand full source code Collapse full source code View on Trac