Customize WordPress Theme Add Home link To Your WordPress Blog
Adding a “Home” link on your WordPress blog can be as simple as pasting some HTML code into a text widget or a theme file. Or it can get as complex as adding a navigation bar to the header. Since I am too lazy to figure out an easy way to tell you how to code and add a navigation bar this WordPress guide will take the easy route to add a home link to your WordPress Blog.
There are any number of places you can add the Home link, and for some reason people like to have these “Home” links on their blog to keep their readers sticking around. My opinion is that most people are now smart enough to navigate a website without all this help but… well any way here you go. The first place we are going to add the link is on the sidebar, now this can be as simple as copying the code I’ve provided below and pasting it into text widget, changing the “Blog Home” part to what ever anchor text you want.
<a <?php if (is_home()) echo(’class=”current” ‘); ?>href=”<?php bloginfo(’url’); ?>”>Blog Home</a>
Or you could experiment with it and paste it directly into the sidebar.php file. If you choose this option make sure it is in an area above this code:
<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar(1) ) : else : ?>
So your code will look like this:
<a <?php if (is_home()) echo(’class=”current” ‘); ?>href=”<?php bloginfo(’url’); ?>”>Blog Home</a>
<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar(1) ) : else : ?>
You could add a background image using a simple table and specifying the location of the image. Make sure the image is always going to be available and live on the internet, I highly suggest using an image you are hosting or will upload to your website. Below is a simple table to center the “Home” link and image. Make sure you change the full image URL location so it will be visible:
<div align=”center”>
<center>
<table border=”0″ width=”100″ height=”30″>
<tr>
<td background=”http://www.ImageLocation.com/Full_Path_Of_Image” width=”112″>
<p align=”center”><a <?php if (is_home()) echo(’class=”current” ‘); ?>href=”<?php bloginfo(’url’); ?>”>Blog Home</a></p>
</td>
</tr>
</table>
</center>
</div>
The code above specifies no border, to add a border change the 0 to a greater number, and the size of the image is 100×30 you can change those numbers to make it bigger or smaller. The td background is the full path of the background image, to find the full path of an image using your Firefox browser simply right click the image and choose View Image and the image will show in its own URL, copy the URL in the address bar. If using Internet Explorer there isn’t that option available so stop using IE and switch to Firefox!
Other places to add a home link is in the bottom navigation on a single post. This is a bit trickier and you will need to edit the theme to do this. Most themes use a single.php file to show a single post, and most have the navigation to the next and previous posts. Some themes may use the index.php file if you don’t have a single.php file. You can also add a link to the blogs home in this area too. Before editing any files make a backup of it if you are new to editing WordPress theme files. Open the file to edit and look for the navigation code. Below I added the home link (in red) between the Previous and Next posts:
<div class=”navigation”>
<?php previous_post_link(’« %link’) ?><a <?php if (is_home()) echo(’class=”current” ‘); ?>href=”<?php bloginfo(’url’); ?>”> Blog Home</a>
<?php next_post_link(’%link »’) ?>
</div>
If the links are too close to each other or the side of the page you can add some space using the bit of code shown to space it out, if you want to add a little space between the links at the bottom of the page add a few hard breaks at the end of the code as shown. So the code used to add a space between the left side of the page and between the three links with a few spaces between it and the bottom of the page would look like below. The red code is the spaces between the links and two hard breaks creating the space at the bottom:
<div class=”navigation”>
<?php previous_post_link(’« %link’) ?>
<a <?php if (is_home()) echo(’class=”current” ‘); ?>href=”<?php bloginfo(’url’); ?>”> Blog Home</a>
<?php next_post_link(’%link »’) ?>
<br /> <br />
</div>
<?php else: ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2><?php _e(’Not Found’); ?></h2>
</div>
The places to add this or other links to your WordPress blog are only limited to your imagination and the time it requires to research more about editing and customizing your WordPress theme.
Customize WordPress WordPress Guide WordPress themeIf you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Tagged with Customize WordPress, WordPress Guide, WordPress theme
Related Posts
9 Responses to "Customize WordPress Theme Add Home link To Your WordPress Blog"
Discussion Area - Leave a Comment
If you have a question about your blog please leave a link to it. Please don't ask questions like "Why don't my blog work right?" and expect an answer. I can't fix stupid.Two links or less are welcome, any more and your comment will be spammed! Nofollow has been disabled, feel free to use your keywords or site name as your name for anchor text. Some comments may be moderated and will not appear until approved. Please submit only once.
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Or just copy the example below and change your details.
Example - <a href="http://www.YourSite.com"
target="_blank">Title Of Site</a>












I have a good read, thanks for the information and insights you have so provided here. I will certainly bookmark your blog for future reads. Thanks Jeff!
You can also look for the “Breadcrumbs” plug-in. This will help users and search engines find their way around your blog.
example: Home > WordPress > Hacks > How to add a navigation bar on your wordpress theme
Nicholas
Adding a home link is vital. I always want to look at the homepage of a website after I read the article to see if I want to add the rss feed to my feed reader
This is really helpful - I am quite new to all this but it is posts like this that help me learn. Thanks for posting it.
Frank Polenose.
Your post is very informative.
I cant wait to apply on my own blog.
Tks a lot !
I can see that becoming a lot of work and messing it up somehow…i’m gonna try the breadcrumb plugin before i cange anything drastic. thanks though.
Its a long process and new users of wordpress can’t do this by them selves. If you have any thing else by which we can do post that. I want to use it for my
pc walkthrough blog.
Sure thing Ram I can create all the content you want for your blog!
Its bad enough people are so lazy that they scrape the web to fill their sites but now they have the balls to request what they want!
Here is a suggestion, how about researching something on your own and writing a coherent post about it.
Great tip. It is cetainly a good idea to make sure you have a home page link on your site. Nothing worse than visiting a site and having to struggle to find your way around - people soon lose interest.