- This topic has 14 replies, 4 voices, and was last updated 7 years ago by
Tom.
-
AuthorPosts
-
December 30, 2014 at 10:32 am #59638
_blank
Site is http://3de.48c.myftpupload.com/
WordPress 4.1
GeneratePress 1.2.4I’ve added a Header image to my site (so that it appears on all pages) using the Background Images Add-on that came with my purchase of GP Premium. I need to have this header image link to a page within the site. Is this possible?
December 30, 2014 at 1:16 pm #59767_blank
I also notice that the header image is not responsive. Is there a better way to add a header image and have it be responsive and linkable?
December 30, 2014 at 6:31 pm #59924Tom
Lead DeveloperLead DeveloperHi Art,
For a header image like that, you’re better of using the “Customize > Header Content” section and upload it as a logo.
Let me know if that works ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 31, 2014 at 8:44 am #60184_blank
OK, that works! TY
btwโฆ
I added cssโฆ
/* tighten space around header image if image is placed using Customize > Header Content */
.inside-header {
padding: 0px;
}and edited the link in the theme’s header.php to make the header image link to a page in the site other than the home page. (be aware that GeneratePress theme updates may overwrite the edit done to header.php)
If there’s a better way to do the link change, please let me know.
December 31, 2014 at 12:18 pm #60248Tom
Lead DeveloperLead DeveloperYou would be better off using a child theme, and copying the header.php file over to your child theme folder. This way, your changes won’t be lost when you update.
However, you’ll also miss out on any changes I make to header.php.
I just went ahead and added a filter to the href of the logo, so once 1.2.5 is released, you can use a snippet of PHP to change the URL without modifying any core files.
It would work like this (Note: This will not work until GeneratePress 1.2.5 is released).
add_filter( 'generate_logo_href','generate_add_custom_logo_href' ); function generate_add_custom_logo_href() { return 'http://yourcustomlogohref.com'; }
-
This reply was modified 7 years ago by
Tom.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentOctober 17, 2015 at 12:02 pm #145245Markus
Hi Tom,
somehow I did not manage to REMOVE any link from the header image.
How do I go about that?
Best wishes,
MarkusOctober 17, 2015 at 11:13 pm #145318Tom
Lead DeveloperLead DeveloperTo remove the link, I would remove the logo from the Customizer.
Then using GP Hooks, add your logo using the “Before Header Content” hook.
<div class="site-logo"> <img class="header-image" src="THE URL TO YOUR LOGO" alt="YOUR WEBSITE NAME" /> </div>
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentOctober 18, 2015 at 9:17 am #145402Markus
Thanks! It worked, of course ๐
All best,
MarkusOctober 18, 2015 at 10:13 am #145413Tom
Lead DeveloperLead DeveloperYou’re welcome ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 11, 2016 at 7:23 am #178525Rachel
Where should I insert this code within the header.php?
It would work like this (Note: This will not work until GeneratePress 1.2.5 is released).
function generate_add_custom_logo_href()
{
return ‘http://yourcustomlogohref.com’;
}March 11, 2016 at 8:38 am #178538Tom
Lead DeveloperLead DeveloperThis should help: https://generatepress.com/knowledgebase/adding-php-functions/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 11, 2016 at 2:14 pm #178615Rachel
Hi Tom,
I created a plugin using your code with my href page name:<?php
function generate_add_custom_logo_href()
{return ‘http://www.actonrecovery.com/rachel-shaw-bio/’;}
?>When clicking on the header logo image, it returns me to my home page. What did I do wrong?
March 11, 2016 at 11:08 pm #178658Tom
Lead DeveloperLead DeveloperHi there,
I just adjusted the code: https://generatepress.com/forums/topic/add-link-to-header-image/#post-60248
Let me know if it works or not ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 12, 2016 at 7:22 am #178735Rachel
Thanks Tom,
The additional line workedMarch 12, 2016 at 8:02 am #178756Tom
Lead DeveloperLead DeveloperYou’re welcome ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
This reply was modified 7 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.