| Small linux deployments » Wordpress: Including nonpages in pages menu | System Administration and Web Application Development Blog

I’d like to be able to include links that are not pages in my pages menu, as most themes display the pages menu as the main navigation bar for the site. The general wisdom has been to hard-code those links into the theme, however I want to be able to intersperse links
with pages, and I want to be able to switch themes without patching all of the themes I use.

I accomplished this with a plugin that takes an array of html to insert at points in the pages menu. For example, in my blog I have a link for “computers” and a link for “other thoughts”, which are before any of the real pages are displayed. The configuration line of my plugin looks like the following:

  1. //An array of items to insert. 0 makes it the first link, 2 makes the link appear after link 2, etc.
  2. $insert_array = array (
  3. 0 => '<li><a href="http://erek.blumenthals.com/blog/category/linux" title="linux">Computers</a></li>',
  4. 1 => '<li><a href="http://erek.blumenthals.com/blog/category/other" title="other">Other Thoughts</a></li>'

To install this in your blog: download the file, customize the insert array with the links you’d like to add, drop the php file in your wp-content/plugins folder, and activate the plugin. Please drop me a line if you decide to use it, as I’m curious what people will do with it. Also feel free to shoot suggestions my way for improvements.

3 Responses to “Wordpress: Including nonpages in pages menu”

  1. futtta Says:

    looks nice, i might give it a go one of these days :)

  2. d00d Says:

    Thanks for this plugin. I’ll be using it on a band site I’m making. (no linky yet)

  3. MG Says:

    Thanks for doing this. This is exactly what I needed and did not want to go into the code to do it.

Leave a Reply