Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! function_exists( 'ultra_display_logo' ) ) :
- /**
- * Display the logo.
- */
- function ultra_display_logo() {
- $logo = siteorigin_setting( 'header_logo' );
- if ( empty( $logo ) && function_exists( 'has_custom_logo' ) && has_custom_logo() ) {
- $logo = get_theme_mod( 'custom_logo' );
- }
- $logo = apply_filters( 'ultra_logo_image_id', $logo );
- if ( empty( $logo ) ) {
- // Just display the site title.
- if ( is_front_page() ) {
- $logo_html = '<h1 class="site-title">' . get_bloginfo( 'name' ) . '</h1>';
- } else {
- $logo_html = '<p class="site-title">' . get_bloginfo( 'name' ) . '</p>';
- }
- $logo_html = apply_filters( 'ultra_logo_text', $logo_html );
- }
- else {
- // Load the logo image.
- if ( is_array( $logo ) ) {
- list ( $src, $height, $width ) = $logo;
- }
- else {
- $image = wp_get_attachment_image_src( $logo, 'full' );
- $src = $image[0];
- $height = $image[2];
- $width = $image[1];
- }
- // Add the logo attributes.
- $logo_attributes = apply_filters( 'ultra_logo_image_attributes', array(
- 'src' => $src,
- 'width' => round( $width ),
- 'height' => round( $height ),
- 'alt' => sprintf( esc_html__( '%s Logo', 'ultra' ), get_bloginfo( 'name' ) ),
- ) );
- if ( siteorigin_setting( 'header_sticky' ) && siteorigin_setting( 'header_scale' ) ) $logo_attributes['data-scale'] = '1';
- $logo_attributes_str = array();
- if ( ! empty( $logo_attributes ) ) {
- foreach ( $logo_attributes as $name => $val ) {
- if ( empty( $val ) ) continue;
- $logo_attributes_str[] = $name . '="' . esc_attr( $val ) . '" ';
- }
- }
- $logo_html = apply_filters( 'ultra_logo_image', '<img '.implode( ' ', $logo_attributes_str ).' />' );
- }
- // Echo the image.
- echo apply_filters( 'ultra_logo_html', $logo_html );
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement