Home » WAHMswers!

How To Add Outbound Link In WordPress Nav Bar

25 June 2009

I this video you’ll learn two different ways to add a link from your wordpress navigation bar to any other page or website on the net.

This is useful to link to other sites you may have in a network of site you own or even to sales pages and affiliate products you want to sell. Use it sparingly to highlight your most important content that’s not directly on your wordpress site.

Your readers or site visitors and more likely to click on what appears to be another page on your site than a link to anywhere and this will help.

Code To Copy For Redirect.PHP file:

<?php
/*
Template Name: Redirect
*/

if (have_posts()) {
the_post();
$pattern = ‘@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@’;
preg_match($pattern, get_the_excerpt(), $matches);
if ($matches[0]) header(‘Location: ‘.$matches[0]);
else echo ‘Enter a URL into your page body text.’;
}
?>

If you found this video helpful or you know someone who may, go ahead and share it using the options below… Your friends will thank you ;0).

Talk soon,


Malika Duke

View Comments »

  • Dan Japikse said:

    Thanks for this tutorial I am using it on my site now!

  • Malika Duke (author) said:

    That’s AWESOME Dan! Let me know how it works please. Make a video showing what you are linking to if you can.

    Malika

  • Karen Stinchfield said:

    Hi Malika,
    This is great information. Now if I could figure out how to get a navigation bar on my site I could use it :) I am so frustrated with wordpress!

Leave your response!

You can subscribe to these comments via RSS.

blog comments powered by Disqus