Site logo

Archived topic

Need to set a different URL for page header logo

7 replies · Started by Rachael on May 17, 2018

Viewing posts 1–8 of 8

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 :)

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 :)

This archived topic is closed to new replies.