- This topic has 14 replies, 4 voices, and was last updated 8 years, 6 months 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_blankI 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 #59924TomLead 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 ๐
December 31, 2014 at 8:44 am #60184_blankOK, 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 #60248TomLead 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 8 years, 6 months ago by Tom.
October 17, 2015 at 12:02 pm #145245MarkusHi 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 #145318TomLead 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>
October 18, 2015 at 9:17 am #145402MarkusThanks! It worked, of course ๐
All best,
MarkusOctober 18, 2015 at 10:13 am #145413TomLead DeveloperLead DeveloperYou’re welcome ๐
March 11, 2016 at 7:23 am #178525RachelWhere 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 #178538TomLead DeveloperLead DeveloperThis should help: https://generatepress.com/knowledgebase/adding-php-functions/
March 11, 2016 at 2:14 pm #178615RachelHi 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 #178658TomLead 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 ๐
March 12, 2016 at 7:22 am #178735RachelThanks Tom,
The additional line workedMarch 12, 2016 at 8:02 am #178756TomLead DeveloperLead DeveloperYou’re welcome ๐
-
AuthorPosts
- You must be logged in to reply to this topic.