Before i faced the problem about inserting a link in the homepage of my WordPress blog, i was not aware that this kind of problem may happen. Some days back one of my client wanted me to put a couple of home page only links. But i did not get his requirement at that time. I just put links in my main sidebar. But that link was site wide link. My client was not asking for a site wide link because there are some disadvantages of site wide links. So, i told him that i am not getting his requirement and then the provided me some guidance about how to put home page only link.
What is Home Page Only Link?
Home Page only links are those backlinks or links which stays only in the home page. You will not be able to see those links on the other webpages of your site. As you will be able to see those links in other page of your site then that is site wide link. There are some disadvantages of site wide links because Google does not like Site Wide links and treat those links as unnatural links.
You can also check my other tips about WordPress which are:
* Add Adsense Below Post Title In WordPress 3.2 Twenty Eleven
*Add Google Adsense Below Blog Header In WordPress 3.2 Twenty Eleven
* Earn Money With Disqus Comment System Plugin in WordPress
How to Add a Home Page Only Links in WordPress Blog?
This is not a difficult task to add a home page only link after you know how to do it. Using two ways you can add a home page only link in your wordpress blog. The procedures are below:
1. Using PHP codes:
Using PHP codes you will be able to add home page only links, actually not only links, if you want to show other contents, you will be able to show those only in homepage. The PHP script is below:
<?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
HOMEPAGE-ONLY LINK OR CONTENT HERE
<?php } ?>
You just need to replace “HOMEPAGE-ONLY LINK OR CONTENT HERE” with your link code or content code. Then you need to add this script in the “Theme Editor” file. You can put the script according to your choice where you want to show the link or content.
If you observe the procedure a bit hard then there is another very easy procedure for you below.
But please remember that the script will not work if you add it in a widget because Widget in WordPress does not support PHP script, it only supports HTML scripts.
2. Add Home Page Only Link in WordPress Blog Using Plugin:
a. At first you need to install the Exec-PHP plugin.
b. Now you need to enable and configure it in your WordPress blog.
c. Now you need to add the below PHP script to the widget and then you just save it and you are done! Please change “HOMEPAGE-ONLY LINK OR CONTENT HERE” with your link code or content code.
<?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
HOMEPAGE-ONLY LINK OR CONTENT HERE
<?php } ?>
Hope that now you will be able to do it by yourself without any problem. If you still face any problem then do not hesitate to contact me through email, Twitter or Facebook fan page or YouTube Channel.
Not working here. Put the code in footer with my text and nothing appears
Hi Lex,
You can use one Plugin which is really useful “Widget Context”. I will help you to show home page only links if you select the tab from drop down as Home Page only.