Be default, most themes will be coded to link your logo or header image to your home url.
In this post, i’ll provide several solutions you can use to change the url your header image is linked to depending on which theme you’re using.
Because of the way themes are coded differently, there’s no one solution which works on all themes.
Genesis Child Themes
Simply copy this code from the view raw link in the Gist and paste it at the end of your child themes functions.php file, then change the URL in the code to suit your own needs.
Source: StudioPress Members Code Snippets
Twenty Twelve Default Theme
You’ll need to copy over the parent themes header.php file to a child theme and modify the code as follows.
Line 49, change this part of the code:
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
To this:
<a href="http://example.com/">
Twenty Thirteen Default Theme
You’ll need to copy over the parent themes header.php file to a child theme and modify the code as follows.
Line 36, change this part of the code:
<a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="
To this:
<a class="home-link" href="http://example.com/" title="
Twenty Fourteen Default Theme
You’ll need to copy over the parent themes header.php file to a child theme and modify the code as follows.
Line 37, change this part of the code:
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
To this:
<a href="http://example.com/" rel="home">
Not very elegant compared to what Genesis offers using the filter.
I’m sure there must be a filter that can be used with non Genesis themes to change the URL a logo or full width header image links to.
Other Options
Update:Kat asked a really good question in the comments about removing the Site Title so here’s a few more options you may find useful.
Remove Site Title
You can easily remove the site title using CSS or simply remove the text from your General Settings > Site Title.
.site-title {
display: none;
}
Remove Header & Add Custom Header
Another option you might like is to remove the default genesis_header and add your own like this:
Step 1. Add this code to your child themes functions.php file to remove the default header:
remove_action( 'genesis_header', 'genesis_do_header' );
Or you could also remove the markup as well but in most cases, best to leave it and modify the default Site Header CSS rules to match your header.
//* Remove site header markup
remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
This option removes all the classes added to the header so all the CSS in your style sheet for different Site Header markup no longer works.
Step 2. Add this PHP to your functions file and change the path to your images folder to match your image file name and extension.
Leave a Reply
You must be logged in to post a comment.