Astra_Ext_Transparent_Header_Markup::transparent_custom_logo( sting $html, int $blog_id )
Replace transparent header logo.
Description
Parameters
- $html
-
(sting) (Required) Size name.
- $blog_id
-
(int) (Required) Icon.
Return
(string) html markup of logo.
Source
File: inc/addons/transparent-header/classes/class-astra-ext-transparent-header-markup.php
public function transparent_custom_logo( $html, $blog_id ) {
$trans_logo = astra_get_option( 'transparent-header-logo' );
$transparent_header_devices = astra_get_option( 'transparent-header-on-devices' );
if ( '' !== $trans_logo ) {
/* Replace transparent header logo and width */
add_filter( 'wp_get_attachment_image_attributes', array( $this, 'replace_trans_header_attr' ), 10, 3 );
$custom_logo_id = attachment_url_to_postid( $trans_logo );
$size = 'ast-transparent-logo-size';
if ( is_customize_preview() ) {
$size = 'full';
}
$html = sprintf(
'<a href="%1$s" class="custom-logo-link transparent-custom-logo" rel="home" itemprop="url">%2$s</a>',
esc_url( home_url( '/' ) ),
wp_get_attachment_image(
$custom_logo_id,
$size,
false,
array(
'class' => 'custom-logo',
)
)
);
if ( 'mobile' === $transparent_header_devices ) {
$html .= sprintf(
'<a href="%1$s" class="custom-logo-link ast-transparent-desktop-logo" rel="home" itemprop="url">%2$s</a>',
esc_url( home_url( '/' ) ),
wp_get_attachment_image(
get_theme_mod( 'custom_logo' ),
$size,
false,
array(
'class' => 'custom-logo',
)
)
);
}
if ( 'desktop' === $transparent_header_devices ) {
$html .= sprintf(
'<a href="%1$s" class="custom-logo-link ast-transparent-mobile-logo" rel="home" itemprop="url">%2$s</a>',
esc_url( home_url( '/' ) ),
wp_get_attachment_image(
get_theme_mod( 'custom_logo' ),
$size,
false,
array(
'class' => 'custom-logo',
)
)
);
}
remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'replace_trans_header_attr' ) );
}
return $html;
}
Expand full source code Collapse full source code View on Trac