[Resolved] Need to set a different URL for page header logo

Home Forums Support [Resolved] Need to set a different URL for page header logo

Home Forums Support Need to set a different URL for page header logo

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #577856
    Rachael

    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.

    #578114
    Leo
    Staff
    Customer Support

    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 ๐Ÿ™‚

    #578137
    Rachael

    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.

    #578147
    Leo
    Staff
    Customer Support

    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';
    }
    #578152
    Rachael

    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.

    #578168
    Leo
    Staff
    Customer Support

    Sorry – edited the code above. Can you give it another shot?

    #578194
    Rachael

    Yup, that’s worked! Thank you very much.

    #578240
    Leo
    Staff
    Customer Support

    Glad I could help ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.