For Bloggers: How to Add a Link to WordPress Homepage Only

0 Shares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 StumbleUpon 0 0 Shares ×

As a WordPress user, it can be very easy to add links to your sidebar and footer using widgets. The content included in these widgets will appear on every page of your WordPress blog. Sometimes you may have a link that needs to be placed on your WordPress homepage only. This may happen when working with advertisers. They may wish to add a link to your WordPress homepage and you’re left with a job you may not know how to handle!

How to Add a Link to WordPress Homepage Only

There are two options for adding a link to your homepage. You can add a PHP script to have WordPress display links or any other content you desire only on your homepage.

php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
php } ?>

Replace the words “PLACE CONTENT FOR THE HOMEPAGE ONLY HERE” with the code for the link or other content you would like to display only on the homepage of your WordPress blog. Add the PHP script to your theme files using the Theme Editor or FTP and you are good to go… unless you want to place it in a widget and then this approach will not work for you and brings me to the second approach.

How to Add a Link to Your WordPress Homepage Only (Widgets too!)

Since PHP codes are not executed in WordPress widgets, if you want to add the link to your sidebar or footer and only have it display on the homepage, there is a plugin for that! (It seems like there is a plugin for almost everything!)

Search for and install the Exec-PHP plugin. Activate the plugin and configure it, if necessary. Then you can add the code above into any of your widgets and your link will show up in your chosen location on the homepage only!

0 Shares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 StumbleUpon 0 0 Shares ×
About Mariah Moon

Mariah is a former teacher and mother of a rambunctious little boy living in The Woodlands, Texas. She recently welcomed a little girl into the family and is learning how to balance a toddler and an infant! She works every day to figure out how to balance all of her roles and figure out her formula for being mom! She can also be found at Mommy Mindset Media, Disney DIY and Noise Girls.


  1. Thank-You I am just beginning to learn things about blogging but I keep a lot of notes,
    Gladys P
    sps1113 at yahoo dot com

Leave a Comment


CommentLuv badge

Disclosure & Privacy Policy   Copyright ©2011-2013 Mariah Moon