Site logo

Archived topic

Base64 for Logo

1 reply · Started by Sars on February 19, 2022

Viewing posts 1–2 of 2

Dear Team,
i would like to use base64 format for Logo. How to achieve this.

Thank you
Sarathy

Hi there,

you can use a PHP snippet like this to filter in your own src:

add_filter( 'generate_logo_output','tu_logo_atts', 10, 2 ); 
function tu_logo_atts( $output, $logo ) {
	printf(
		'<div class="site-logo">
			<a href="%1$s" title="%2$s" rel="home">
				<img src="your_base64_date_source_goes_here" alt="logo alt" />
			</a>
		</div>',
		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
		esc_url( apply_filters( 'generate_logo', $logo ) )
	);
}

How to add PHP: https://docs.generatepress.com/article/adding-php/

This archived topic is closed to new replies.