Specify WordPress Navigation Page Links

If your WordPress blog has a navigation or top menu bar that shows all your WordPress pages and you create a lot of pages this can become quite cluttered. You can change this to specify the pages or links displayed from within your WordPress themes template files. This shows how to specify WordPress navigation page links.

First your themes files need to be writable in order to edit them from within the WordPress dashboard or you will need to edit the file and upload it with an FTP client. From within the WordPress dashboard click Presentation then Theme Editor. On the right side of the theme editor click Header to open the header.php file. Depending on your theme you should see some code that looks like this:

<div id="top-menu">
<ul>
<li><a <?php if (is_home()) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>">Home</a></li>
<?php wp_list_pages(’depth=1&title_li=’); ?>

</ul> </div>

The piece of code that shows the pages is in red. This is showing all pages you create and doing so can cause that list to grow quite large. You can just remove that code and hard code the actual pages you want in that area.

If you are a not familiar with editing WordPress themes make sure to copy all the code in the file and save it so you can restore any mistakes you might make!

Now just remove the bit of code in read and replace it with a regular HTML formatted code like this:

<div id="top-menu">
<ul>

<li><a <?php if (is_home()) echo('class="current" ');
?>href="<?php bloginfo('url'); ?>">Home</a></li>

<a href="http://www.TheURL.com/" title="Page
Title Here">Page Title Here</a>

<a href="http://www.TheURL.com/" title="Page
Title Here">Page Title Here</a>

</ul> </div>

If you copy the above code to use it on your site and doesn’t work check for the proper format of all the quotes ” I tried to format them so they come through properly but may have missed one! To replace the curly quotes ” with regular ones just remove them and simply retype them again.

(I really need a good plugin to show raw HTML and PHP code in posts)

Now you can specify the exact page, or any URL for that matter simply by hard coding it directly into your WordPress header.php file.



Share This AddThis Social Bookmark Button Sphinn Gregarious FeedFlare

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!


Tagged with


Related Posts





4 Responses to “Specify WordPress Navigation Page Links”

  1. […] ‘hard code’ any URL in the WordPress navigation bar as this previous post explains: Specify WordPress Navigation Page Links Customize WordPress WordPress WordPress Guide WordPress guides Share This Gregarious […]

  2. Thanx your article

  3. Hi, I am a complete newbie with no clue what I am doing, the worst kind of user.. just enough to be dangerous. I enter my wordpress entries directly from my website, and as such they have the format of my website, so how do I use such things as listing only the last post ? or the summary and more option? When I change these in the admin they are really only changing them on wordrpess external display which incidently and probably correctly does not display the post I write from whithin the website.. Should they be the same? Should entries made from /myblog/admin show up on main page (at website above) where I typically write my entries? is it just a path thing.. hope this makes sense.

  4. Sorry Lisa, but no, it makes no sense to me at all.

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.

Two links or less are welcome, any more and your comment will be spammed! Nofollow has been disabled, all comments are 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">Title Of Site</a>







Close
E-mail It