- This topic has 13 replies, 4 voices, and was last updated 5 years, 1 month ago by bdbrown.
October 14, 2015 at 8:14 am #144277Guido Wenzl
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.October 14, 2015 at 10:38 am #144319TomLead DeveloperLead Developer
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 🙂October 14, 2015 at 2:00 pm #144404bdbrown
That’s a great solution Tom 🙂October 14, 2015 at 2:12 pm #144407Guido 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?October 14, 2015 at 2:18 pm #144409Guido Wenzl
It is working now . I made the mistake by not removing the logo in the GP settings.
Thanks!October 14, 2015 at 4:16 pm #144429TomLead DeveloperLead DeveloperOctober 14, 2015 at 10:26 pm #144484Guido Wenzl
is there a way to change the footer text in the same way?
GuidoOctober 14, 2015 at 11:19 pm #144492TomLead DeveloperLead DeveloperOctober 14, 2015 at 11:55 pm #144495Guido Wenzl
Yes. The same I did with The Header.October 15, 2015 at 10:32 am #144631TomLead DeveloperLead 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 🙂October 27, 2015 at 8:58 am #147994Guido Wenzl
I want to have the (changing) logo in the header clickable with a link. Is this also possible? How to achieve this?
GuidoOctober 27, 2015 at 11:09 am #148023bdbrown
Do you want the same link for every image? Or does each image need a separate link?October 27, 2015 at 11:19 am #148032Guido Wenzl
If it is possible it would be good to have different links with different logos.October 27, 2015 at 11:42 am #148039bdbrown
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; ?>
- You must be logged in to reply to this topic.