Archived topic
Need to set a different URL for page header logo
7 replies · Started by Rachael on May 17, 2018
Hi, on the pages that use a specific header with a different logo, I need the URL of that logo to go to a page (not the homepage of the website).
I have seen this and input it:
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ( is_home() )
return 'http://test.ergapc.co.uk/erg-services/';
}
But it doesn't work. It just takes you to the same page you're on. Any suggestions please? Thank you.
Hi there,
Which page are you trying to apply this to and which page are you trying to redirect it to?
Right now your statement says "if we are on the blog/posts page, the logo link will take users to http://test.ergapc.co.uk/erg-services/
Let me know :)
Ah OK thank you. So if I leave it as is (without anything added in) it goes to the main homepage. But when on this page http://test.ergapc.co.uk/erg-services/ and all the pages that have this as a parent and use this specific header and logo (for example http://test.ergapc.co.uk/erg-services/water/odour-control/, the logo at the top in the header needs to go to http://test.ergapc.co.uk/erg-services/
Thank you.
Hmm can you try this:
add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
function generate_add_custom_logo_href()
{
if ( is_page( 'erg-services' ) ) {
return 'http://test.ergapc.co.uk/erg-services/';
}
return 'http://HomePageURL.com';
}
Tried that but it kept showing syntax errors. First an extra { and then an extra return.
Is there another way to achieve this? Using the header in Generate press is great but the logo URL needs to have a way to be changed along with it. Thank you.
Sorry - edited the code above. Can you give it another shot?
Yup, that's worked! Thank you very much.
Glad I could help :)