[Resolved] Change Header Logo

Home Forums Support [Resolved] Change Header Logo

Home Forums Support Change Header Logo

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #144277
    Guido Wenzl

    Hi,
    I want to display a different header logo on specific pages inside my WordPress Installation.
    Is this possible? I know it is possible with Blog Header, but I do not find a way to change the header logo.
    Thanks.

    #144319
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I explained one method that can accomplish this here: https://generatepress.com/forums/topic/change-site-header-and-title-based-on-page/#post-111841

    Let me know if you need more info 🙂

    #144404
    bdbrown

    That’s a great solution Tom 🙂

    #144407
    Guido Wenzl

    Yes, it looks like a perfect solution, but I am getting an error.
    On the page with the custom header it does show both logos side by side. All the other pages stay with the default logo.
    What am I doing wrong because I followed every line from you solution?

    #144409
    Guido Wenzl

    It is working now . I made the mistake by not removing the logo in the GP settings.
    Thanks!

    #144429
    Tom
    Lead Developer
    Lead Developer

    No problem! Glad I could help 🙂

    #144484
    Guido Wenzl

    Hi Tom,

    is there a way to change the footer text in the same way?

    Best regards,
    Guido

    #144492
    Tom
    Lead Developer
    Lead Developer

    You want to change the footer content on a per-page basis?

    #144495
    Guido Wenzl

    Yes. The same I did with The Header.

    #144631
    Tom
    Lead Developer
    Lead Developer

    1. Remove the default copyright with this function: https://gist.github.com/generatepress/36c0c52479679252af28 (https://generatepress.com/knowledgebase/adding-php-functions/)

    2. Now look for the “Custom Fields” metabox – click “Enter new”.

    3. Under “Name”, add: custom_footer

    4. Under “Value”, enter your copyright message

    5. Now in GP Hooks, in the “Before Footer Content” hook, add this:

    <?php
    global $post;
    $copyright = get_post_meta($post->ID, 'custom_footer', true);
    if ( ! empty( $copyright ) ) : ?>
          <?php echo $copyright; ?>
    <?php else : ?>
          My default copyright message
    <?php endif; ?>

    Be sure to check the “Execute PHP” checkbox.

    Something like that should do the trick 🙂

    #147994
    Guido Wenzl

    Hi Tom,

    I want to have the (changing) logo in the header clickable with a link. Is this also possible? How to achieve this?

    Thanks

    Guido

    #148023
    bdbrown

    Do you want the same link for every image? Or does each image need a separate link?

    #148032
    Guido Wenzl

    If it is possible it would be good to have different links with different logos.

    #148039
    bdbrown

    You would follow the same process as above to add a custom field for the link:

    1. In the “Custom Fields” metabox – click “Enter new”.

    2. Under “Name”, add: custom_link

    3. Under “Value”, enter your link URL

    4. In GP Hooks, in the “Before Header Content” hook, change the code to this to wrap the image in an anchor tag:

    <?php
    global $post;
    $image = get_post_meta($post->ID, 'custom_header', true);
    $link = get_post_meta($post->ID, 'custom_link', true);
    if ( ! empty( $image ) ) : ?>
          <a href="<?php echo $link; ?>"><img src="<?php echo $image; ?>" alt="" /></a>
    <?php else : ?>
          <img src="URL TO MY DEFAULT LOGO" alt="" />
    <?php endif; ?>
    
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.