Site logo

Archived topic

Custom Category Logo Not Showing On Sticky Scroll For Category Single Post Pages

1 reply · Started by Michelle on July 31, 2022

Viewing posts 1–2 of 2

How do I replace my site logo with a custom category logo on sticky scroll on category single post pages?

Hi Michelle,

You can try this snippet:

add_filter('generate_sticky_navigation_logo_output',function($output, $img_src, $image){
	if( is_category(29) ){
		$my_url = 'https://www.google.com';
		$logo_src = 'https://cdn.reachingmyworld.com/wp-content/uploads/2022/06/18162522/Daily-Reach-Logo-For-Site.png';
		$width = '150px';
		$height = '150px';
		return sprintf(
				'<div class="sticky-navigation-logo">
					<a href="%1$s" title="%2$s" rel="home">
						<img src="%3$s" class="is-logo-image" alt="%2$s" width="%4$s" height="%5$s" />
					</a>
				</div>',
				$my_url,
				get_bloginfo( 'name', 'display' ),
				$logo_src,
				$width,
				$height
			);
	}
	return $output;
}, 10, 3);

Kindly replace 29 with you category ID

This archived topic is closed to new replies.