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

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

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

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #605526
    Heiko

    The code is correct BUT not for subpages. It is quite more difficult to loop through all subpages. But try the code from https://developer.wordpress.org/reference/functions/is_page/ (down at the bottom Snippet 4) or you use get_post_ancestors($post).

    Maybe this will help you as well: https://wordpress.stackexchange.com/questions/169306/check-if-is-on-child-page-of-a-particular-page

    #605543
    Leo
    Staff
    Customer Support

    Is erg-services a category?

    If so we might be able to do this:

    add_filter( 'generate_logo_href','generate_add_custom_logo_href' );
    function generate_add_custom_logo_href()
    {
        if ( in_category( 'erg-services' ) ) {
            return 'http://test.ergapc.co.uk/erg-services/';
        }
    
        return 'http://test.ergapc.co.uk/';
    }
    #605770
    Rachael

    Thank you I will try that out Heiko. No Leo, it is not a category. It is a top level page. I’ll let you know the result!

    #606169
    Leo
    Staff
    Customer Support

    If Heiko’s method doesn’t work then you might need to consider making it into a category so there is actually relationship outside the menu items 🙂

    It would make a bit more sense too.

    #606941
    Rachael

    Because all of the logo links were working apart from on the Group page, I disabled the link on the Group logo. It is a landing page and does not have any child pages so it doesn’t actually need to link anywhere. So it’s all set. Thank you for all of your help!

    #606972
    Leo
    Staff
    Customer Support

    Awesome.

    Glad you found a solution!

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.