Adding custom links to the navigation menu of a WordPress site is a common need, but not easy to do in the current version of WordPress (2.6). Sometimes it is done by editing template files, which is not good.
“Page Links To” is a plugin by Mark Jaquith that offers a nice and quick workaround to do this without modifying any code.
Let’s say that your navigation menu does not have a “Home” link and that you want to add one:
Install and activate “Page Links To”: txfx.net/code/wordpress/page-links-to
How to install a WordPress plugin
Make a new page (not post) with the title you want to appear on the menu — “Home”, “Home Page”, your site’s name or whatever else you prefer. Here I’m using the site’s name:
You don’t need to add any text to the page. You can if you want, but no one will see it. :-) Also, the permalink of the page is not relevant: no one will see that either.
Scroll to the bottom and enter the URL of the home page:
Scroll up again and click Save.
Refresh a page to see the menu with the new item on it:
Now, every time the new link is clicked, it will redirect to the home page. The redirection is transparent to visitors, and the permalink of the page does not appear anywhere. When the link is hovered over, the status bar of the browser displays the URL of the final target — in the example above: https://op111.net/
- PAGE ORDER. If the link does not apper in the position you want, you can move it by changing the Page Order number of the new page or/and of the other pages that appear on the menu. (See above, penultimate screenshot.)
- PAGES WIDGET. If you use the Pages widget and don’t want the link to appear there, go to Design, Widgets, click to Edit the widget and add the page ID number to the exclusion list. (How do I find page ID numbers?)
- TOOLTIPS. ADDED 2008-10-30. If you want to change the default WordPress link description to something more useful (see above, last screenshot), see: Add meaningful tooltips to your WordPress menu links with Page Menu Editor – op111.net
A few more words
Adding links to the menu is just one possible application of “Page Links To”, which is a plugin made to facilitate page redirection in general — see its page for some other common scenarios. Once you install it, you will probably find more uses for it.
Thanks for reading!
- trac.wordpress.org/ticket/7698 —
In WordPress 2.7 (due in November 2008) the new
wp_page_menu()function will provide theme authors with an easy way to offer this option.
- ivovic.net/2008/05/20/turn-a-wordpress-page-into-a-link — An alternative way to insert links into the navigation menu, always without touching template files, by Milorad Ivović.