Dropdown Menus & Site Maps

Posted 2009.11.10 14.07 in Computers/Internet/Technology by Stephanie

I just finished hacking up a plugin for my website here. With over 60 pages nested in levels and sub-levels, I’ve been worried that visitors won’t always know where they are on the site or what else is available.

A while back I added a sort of location indicator to pages, that helps identify where on the site you are. For instance, if you’re on the Snail Cam! page, then at the top of the page you’d see something like this: “Home » About Me » Snails! » Snail Cam!

So, that sort of indicates where you are relative to the top but still doesn’t show whate else is around. I’ve had a drop-down menu thing going on almost since the start, and it does show all the different pages, but it’s organized in hierarchical levels and you would really have to be hunting in order to find things. If you don’t mouse-over everything, you’ll miss stuff.

What I really needed was a site-map, and to put a link to it on the top menu bar so it couldn’t be missed.

As I started working on making this happen, I realized that a site map would be very similar to the existing dropdown menu, in that it would have to search all the pages and organize them into a hierarchical format. I mean, there’s no way I was going to manually create a page-map – it’s too much work and then it’d be out of date as soon as I changed or added something.

I looked at the plugin I had for the dropdown menus. It was complicated and did a lot of stuff I didn’t want or like. As I figured out how it worked and started building my sitemap plugin, I realized I could use the same function to build both a menu and a sitemap – streamline things, eliminate redundancy, and get rid of the aspects of the menu that bothered me.

Pretty soon I had something that I felt was slick and simple, did exactly what I wanted and nothing else. The only difference really between displaying the pages as a menu or as a sitemap boils down to one line of code that tells it what class to look for in the stylesheet. Everything then is either html or css, with no scripting etc. required.

I’ve packaged it up into a simple little plugin that works with the current version of wordpress (2.8.x), and probably works with 2.7 as well. Bear in mind, it comes with no guarantees or promises – if you use it, you’re on your own. There is a readme file in the package that explains how to get it up and running.

Click here to download the Menu_Map plugin.

Leave a Comment