- This topic has 5 replies, 3 voices, and was last updated 3 years, 3 months ago by
Ying.
Viewing 6 posts - 1 through 6 (of 6 total)
-
AuthorPosts
-
January 14, 2023 at 10:16 pm #2495911
webyogi
Hi,
I tried using the Header Element with the Display Rules set for a specific page and it shows a different logo for that page but I also want a different sticky logo for that page, how do I achieve that?
Thanks.
January 15, 2023 at 8:48 am #2496395David
StaffCustomer SupportHi there,
it requires a PHP Snippet to do that, here for example:
add_filter( 'generate_sticky_navigation_logo_output', function($logo) { if ( ! is_user_logged_in() ) { return; } return sprintf( '<div class="sticky-navigation-logo"> <a href="%1$s" title="%2$s" rel="home"> <img src="your_logo_url" class="is-logo-image" alt="alt name" width="100" height="100" /> </a> </div>', esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ) ); } );That will swap the logo if th user is logged in, if you want to let me know what conditions you want to show the logo i can update thee code
January 15, 2023 at 10:26 am #2496504webyogi
Hey David,
So if I want to change the sticky image for a specific page, then I guess code will be:
add_filter( 'generate_sticky_navigation_logo_output', function($logo) { if ( ! is_page( 447 ) ) { return; } return sprintf( '<div class="sticky-navigation-logo"> <a href="%1$s" title="%2$s" rel="home"> <img src="your_logo_url" class="is-logo-image" alt="alt name" width="100" height="100" /> </a> </div>', esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ) ); } );January 15, 2023 at 1:33 pm #2496606Ying
StaffCustomer SupportHi there,
The code would be:
add_filter( 'generate_sticky_navigation_logo_output', function($logo) { if ( ! is_page( 447 ) ) { return $logo; } return sprintf( '<div class="sticky-navigation-logo"> <a href="%1$s" title="%2$s" rel="home"> <img src="your_logo_url" class="is-logo-image" alt="alt name" width="100" height="100" /> </a> </div>', esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ) ); } );January 16, 2023 at 10:15 am #2497821webyogi
Thanks David and Ying.
January 16, 2023 at 11:03 am #2497889Ying
StaffCustomer SupportYou are welcome 🙂
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.