astra_logo( string $device = 'desktop', bool $echo = true )
Return or echo site logo markup.
Description
Parameters
- $device
-
(string) (Optional) Device name.
Default value: 'desktop'
- $echo
-
(bool) (Optional) Echo markup.
Default value: true
Return
(mixed) echo or return markup.
Source
File: inc/markup-extras.php
function astra_logo( $echo = true ) {
$site_tagline = astra_get_option( 'display-site-tagline-responsive' );
$display_site_tagline = ( $site_tagline['desktop'] || $site_tagline['tablet'] || $site_tagline['mobile'] ) ? true : false;
$site_title = astra_get_option( 'display-site-title-responsive' );
$display_site_title = ( $site_title['desktop'] || $site_title['tablet'] || $site_title['mobile'] ) ? true : false;
$html = '';
$has_custom_logo = apply_filters( 'astra_has_custom_logo', has_custom_logo() );
// Site logo.
if ( $has_custom_logo ) {
if ( apply_filters( 'astra_replace_logo_width', true ) ) {
add_filter( 'wp_get_attachment_image_src', 'astra_replace_header_logo', 10, 4 );
}
$html .= '<span class="site-logo-img">';
$html .= get_custom_logo();
$html .= '</span>';
if ( apply_filters( 'astra_replace_logo_width', true ) ) {
remove_filter( 'wp_get_attachment_image_src', 'astra_replace_header_logo', 10 );
}
}
$html .= astra_get_site_title_tagline( $display_site_title, $display_site_tagline );
$html = apply_filters( 'astra_logo', $html, $display_site_title, $display_site_tagline );
/**
* Echo or Return the Logo Markup
*/
if ( $echo ) {
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $html;
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |