Archived topic
Custom link for logo using element header link
3 replies · Started by Mike on May 28, 2021
I'm creating separate landing pages for vendors that the company works with and using the element header to place the logos of the different companies.
The element function has made this really easy, so I can place in different headers, footers and so on.
The one issue that I'm trying to solve is how to have the logo that I've assigned for that specific header element to go to another url and not my website's homepage.
I've seen generate_logo_href mentioned on the threads, but not sure how to apply it for this.
Thank you!
Hi Mike,
You could try something like this:
add_filter( 'generate_logo_href', function() {
if ( is_page( 373 ) ) {
return 'http://your-custom-link';
}
return "http://your-default-site-link.com";
} );
You can find the page id by using developer tool of chrome:
https://www.screencast.com/t/0s1bfpkW9
Adding PHP: https://docs.generatepress.com/article/adding-php/
That works great, thanks Ying!
Glad it works :) You are welcome!