%3$s
%1$s>',
tag_escape( $site_title_tag ),
esc_url( $site_url ),
esc_html( $site_title ),
bloghash_get_schema_markup( 'name' ),
bloghash_get_schema_markup( 'url' ),
esc_attr($class)
)
);
// Output site description if enabled in Customizer.
$class = !$display_site_description ? ' screen-reader-text' : '';
if( bloghash_get_site_description() ) {
$site_description_output = apply_filters(
'bloghash_site_description_markup',
sprintf(
'
%1$s
',
esc_html( bloghash_get_site_description() ),
bloghash_get_schema_markup( 'description' ),
esc_attr($class)
)
);
}
$output = '' . $site_logo_output . $site_title_output . $site_description_output . '
';
// Allow output to be filtered.
$output = apply_filters( 'bloghash_logo_output', $output );
// Echo or return the output.
if ( $echo ) {
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $output;
}
}
endif;
if ( ! function_exists( 'bloghash_get_logo_img_output' ) ) :
/**
* Outputs logo image markup.
*
* @param int $logo Attachment ID of the logo image.
* @param int $retina Attachment ID of the retina logo image.
* @param string $class Additional CSS class.
* @since 1.0.0
*/
function bloghash_get_logo_img_output( $logo, $retina = '', $class = '' ) {
$output = '';
// Logo attributes.
$logo_attr = array(
'url' => '',
'width' => '',
'height' => '',
'class' => '',
'alt' => '',
);
// Check if a custom logo has been uploaded.
if ( $logo ) {
// Get default logo src, width & height.
$default_logo_attachment_src = wp_get_attachment_image_src( $logo, 'full' );
if ( $default_logo_attachment_src ) {
$logo_attr['url'] = $default_logo_attachment_src[0];
$logo_attr['width'] = $default_logo_attachment_src[1];
$logo_attr['height'] = $default_logo_attachment_src[2];
}
// Check if uploaded logo is SVG.
$mimes = array();
$mimes['svg'] = 'image/svg+xml';
$file_type = wp_check_filetype( $logo_attr['url'], $mimes );
$file_extension = $file_type['ext'];
if ( 'svg' === $file_extension ) {
$logo_attr['width'] = '100%';
$logo_attr['height'] = '100%';
$logo_attr['class'] = 'bloghash-svg-logo';
}
// Get default logo alt.
$default_logo_alt = get_post_meta( $logo, '_wp_attachment_image_alt', true );
$logo_attr['alt'] = $default_logo_alt ? $default_logo_alt : bloghash_get_site_title();
// Build srcset attribute.
$srcset = '';
if ( $retina ) {
$retina_logo_image = wp_get_attachment_image_url( $retina, 'full' );
if ( $retina_logo_image ) {
$srcset = ' srcset="' . esc_attr( $logo_attr['url'] ) . ' 1x, ' . esc_attr( $retina_logo_image ) . ' 2x"';
}
}
// Build logo output.
$output = sprintf(
'
',
esc_url( bloghash_get_site_url() ),
esc_attr( trim( $class ) ),
bloghash_get_schema_markup( 'url' ),
esc_url( $logo_attr['url'] ),
esc_attr( $logo_attr['alt'] ),
esc_attr( $logo_attr['width'] ),
esc_attr( $logo_attr['height'] ),
esc_attr( $logo_attr['class'] ),
$srcset,
bloghash_get_schema_markup( 'logo' )
);
}
return $output;
}
endif;
if ( ! function_exists( 'bloghash_edit_post_link' ) ) :
/**
* Function to get Edit Post Link
*
* @since 1.0.0
*
* @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null.
* @param string $before Optional. Display before edit link. Default empty.
* @param string $after Optional. Display after edit link. Default empty.
* @param int|WP_Post $id Optional. Post ID or post object. Default is the global `$post`.
* @param string $class Optional. Add custom class to link. Default 'post-edit-link'.
*/
function bloghash_edit_post_link( $text, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) {
if ( apply_filters( 'bloghash_edit_post_link', true ) && get_edit_post_link() ) {
edit_post_link( $text, $before, $after, $id, $class );
}
}
endif;
if ( ! function_exists( 'bloghash_page_header_title' ) ) :
/**
* Output the Page Header title tag.
*
* @since 1.0.0
* @param boolean $echo Display or return the title.
*/
function bloghash_page_header_title( $echo = true ) {
$title = apply_filters( 'bloghash_page_header_title', bloghash_get_the_title() );
$tag = apply_filters( 'bloghash_page_header_title_tag', 'h1' );
$class = array( 'page-title' );
$class = apply_filters( 'bloghash_page_header_title_class', $class );
if ( ! empty( $class ) ) {
$class = ' class="' . esc_attr( trim( implode( ' ', $class ) ) ) . '"';
} else {
$class = '';
}
$before = '<' . tag_escape( $tag ) . $class . bloghash_get_schema_markup( 'headline' ) . '>';
$after = '' . tag_escape( $tag ) . '>';
$title = $before . wp_kses( $title, bloghash_get_allowed_html_tags() ) . $after;
if ( $echo ) {
echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $title;
}
}
endif;
if ( ! function_exists( 'bloghash_hamburger' ) ) :
/**
* Output the hamburger button.
*
* @since 1.0.0
*
* @param string $button_title Menu title.
* @param string $menu_id Menu ID.
*/
function bloghash_hamburger( $button_title, $menu_id ) {
$classes = array( 'bloghash-hamburger', 'hamburger--spin', 'bloghash-hamburger-' . esc_attr( $menu_id ) );
$classes = apply_filters( 'bloghash_hamburger_menu_classes', $classes );
$classes = trim( implode( ' ', $classes ) );
?>
max_num_pages <= 1 ) {
return;
}
?>
'' . esc_html__( 'Pages', 'bloghash' ) . '',
'after' => '
',
'link_before' => '',
'link_after' => '',
)
);
}
endif;
if ( ! function_exists( 'bloghash_animated_arrow' ) ) :
/**
* Output the animated button HTML markup.
*
* @since 1.0.0
* @param string $style button style. Can be 'right', or 'left'.
* @param string $type type attribute for