'header-image',
'src' => $logo_url,
'title' => esc_attr( apply_filters( 'shesha_logo_title', get_bloginfo( 'name', 'display' ) ) ),
) );
if ( '' !== $retina_logo_url ) {
$attr[ 'srcset' ] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x';
// Add dimensions to image if retina is set. This fixes a container width bug in Firefox.
if ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) {
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
if ( ! empty( $data ) ) {
$attr['width'] = $data['width'];
$attr['height'] = $data['height'];
}
}
}
$attr = array_map( 'esc_attr', $attr );
$html_attr = '';
foreach ( $attr as $name => $value ) {
$html_attr .= " $name=" . '"' . $value . '"';
}
// Print our HTML.
echo apply_filters( 'shesha_logo_output', sprintf( // WPCS: XSS ok, sanitization ok.
'',
esc_url( apply_filters( 'shesha_logo_href' , home_url( '/' ) ) ),
esc_attr( apply_filters( 'shesha_logo_title', get_bloginfo( 'name', 'display' ) ) ),
$html_attr
), $logo_url, $html_attr );
/**
* shesha_after_logo hook.
*
*/
do_action( 'shesha_after_logo' );
}
}
if ( ! function_exists( 'shesha_construct_site_title' ) ) {
/**
* Build the site title and tagline.
*
*/
function shesha_construct_site_title() {
$shesha_settings = wp_parse_args(
get_option( 'shesha_settings', array() ),
shesha_get_defaults()
);
// Get the title and tagline.
$title = get_bloginfo( 'title' );
$tagline = get_bloginfo( 'description' );
// If the disable title checkbox is checked, or the title field is empty, return true.
$disable_title = ( '1' == $shesha_settings[ 'hide_title' ] || '' == $title ) ? true : false;
// If the disable tagline checkbox is checked, or the tagline field is empty, return true.
$disable_tagline = ( '1' == $shesha_settings[ 'hide_tagline' ] || '' == $tagline ) ? true : false;
// Build our site title.
$site_title = apply_filters( 'shesha_site_title_output', sprintf(
'<%1$s class="main-title" itemprop="headline">
%3$s
%1$s>',
( is_front_page() && is_home() ) ? 'h1' : 'p',
esc_url( apply_filters( 'shesha_site_title_href', home_url( '/' ) ) ),
get_bloginfo( 'name' )
) );
// Build our tagline.
$site_tagline = apply_filters( 'shesha_site_description_output', sprintf(
'
%1$s
',
html_entity_decode( get_bloginfo( 'description', 'display' ) )
) );
// Site title and tagline.
if ( false == $disable_title || false == $disable_tagline ) {
echo apply_filters( 'shesha_site_branding_output', sprintf( // WPCS: XSS ok, sanitization ok.
'
%1$s
%2$s
',
( ! $disable_title ) ? $site_title : '',
( ! $disable_tagline ) ? $site_tagline : ''
) );
}
}
}
if ( ! function_exists( 'shesha_construct_header_widget' ) ) {
/**
* Build the header widget.
*
*/
function shesha_construct_header_widget() {
if ( is_active_sidebar('header') ) : ?>
' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
}
if ( ! function_exists( 'shesha_add_viewport' ) ) {
add_action( 'wp_head', 'shesha_add_viewport' );
/**
* Add viewport to wp_head.
*
*/
function shesha_add_viewport() {
echo apply_filters( 'shesha_meta_viewport', '' ); // WPCS: XSS ok.
}
}
add_action( 'shesha_before_header', 'shesha_do_skip_to_content_link', 2 );
/**
* Add skip to content link before the header.
*
*/
function shesha_do_skip_to_content_link() {
printf( '%2$s',
esc_attr__( 'Skip to content', 'shesha' ),
esc_html__( 'Skip to content', 'shesha' )
);
}
add_action( 'shesha_before_header', 'shesha_side_padding', 1 );
/**
* Add holder div if sidebar padding is enabled
*
*/
function shesha_side_padding() {
$shesha_settings = wp_parse_args(
get_option( 'shesha_spacing_settings', array() ),
shesha_spacing_get_defaults()
);
if ( ( $shesha_settings[ 'side_top' ] != 0 ) || ( $shesha_settings[ 'side_right' ] != 0 ) || ( $shesha_settings[ 'side_bottom' ] != 0 ) || ( $shesha_settings[ 'side_left' ] != 0 ) ) {
?>