Astra_Ext_Advanced_Headers_Markup::add_custom_logo( string $html, string $blog_id )

Add cutom Logo for Advanced Headers


Description


Parameters

$html

(string) (Required) Markup of custom logo.

$blog_id

(string) (Required) blog id.


Return

(strung) $html updated Markup of Custom Logo.


Source

File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-markup.php

		public function add_custom_logo( $html, $blog_id ) {

			$advanced_headers_merged       = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'merged' );
			$advanced_headers_inherit_logo = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_layout_option( 'diff-header-logo' );

			if ( ! $advanced_headers_merged || ( is_front_page() && 'posts' == get_option( 'show_on_front' ) ) || 'enabled' != $advanced_headers_inherit_logo ) {
				return $html;
			}

			$custom_logo_id = Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'logo-id' );

			// Site logo.
			if ( $custom_logo_id ) {

				add_filter( 'astra_main_header_retina', '__return_false' );

				add_filter( 'wp_get_attachment_image_attributes', array( $this, 'adv_replace_header_logo_attr' ), 10, 3 );

				// Custom Site logo.
				$html = sprintf(
					'<a href="%1$s" class="custom-logo-link advanced-header-logo" rel="home" %3$s >%2$s</a>',
					esc_url( home_url( '/' ) ),
					wp_get_attachment_image(
						$custom_logo_id,
						'ast-adv-header-logo-size',
						false,
						array(
							'class' => 'custom-logo',
						)
					),
					astra_attr(
						'site-title-custom-link',
						array(
							'class' => '',
						)
					)
				);

				remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'adv_replace_header_logo_attr' ) );
			}

			return $html;
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.