How To Add an Off-Site Link To Your Navigation Bar In WordPress
There are actually two simple ways to add a link to your WordPress navigation bar, but only one of them is worth using. There are many tutorial sites that advise you use a page template called redirect.php for the redirect function. It works…mostly. The problem with it is if you need to redirect your navigation link to a website with dashes or underscores in the web address, it will recognize the only URL to the point where the first dash or underscore appears. So, for example, if I were using redirect.php for my navigation bar link that says “More Free Themes”, instead of taking you to the Squidoo lens where my free themes used to be published, http://www.squidoo.com/free-wordpress-themes-by-icy, the link would only go to http://www.squidoo.com/free.
That stinks
The good news is that there is another solution availabe that is even easier to apply, since it doesn’t require you to upload anything to your server via FTP. You can make the addition right from within WordPress using the Theme Editor.
Originally posted by Alex Mansfield, I found the following solution to be universal an easier to use all the way around. First, create a new page in WordPress and make the title of the page the text that you want to appear on the button (ex., for my “More Free Themes” button, the title of the page would be “More Free Themes). However, leave the body of the page blank. Then, in the WordPress Theme Editor open the header.php file in the theme you are using and add the following code to the very top:
if(is_page('your-page-slug')){
header("HTTP/1.1 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header("Location: http://www.your-redirect-location.com");
header("Connection: close");
exit(0); // Optional, prevents any accidental output
}
?>
Replace “your-page-slug” with the slug, or the part of the page adress that comes after the slash behind blog address (http://www.yourblogaddress.com/your-page-slug) and replace “your-redirect-location.com” with the URL of the page you want the button to redirect to. Instead of taking you to the blank page, the link will go directly to the redirect location.
That’s it! There is indeed more than one way to skin the proverbial cat
To your continued success,
I.C. Jackson


















Awesome themes! I’m going to test most of them on my wordpress site.