How can I alter the behavior of my WordPress menu?
December 21, 2010 7:46 PM   Subscribe

WordPress menu question: I have a WordPress site which has a menu bar and some drop-down menus. I don't want the "root" of each drop down to lead anywhere...

...in other words, I have one menu item that says, "Youth" and obviously, that leads to the Youth page... but I also have one that says, "About Us" - and when you mouse-over that you get a drop down, "Our Staff", 'Our History" and "Our Beliefs". When you click "About Us" I don't want it to go anywhere - but it does. It goes to a WordPress page called "About Us". For now, I have edited that page to have three hyperlinks to the staff, history and beliefs page... but it looks cheesy. Anyone know how to do this? (I am not a webmaster.. this is a volunteer position and ya get what ya pay for!)
posted by brownrd to Computers & Internet (7 answers total) 1 user marked this as a favorite
 
Are you familiar enough with your code to identify how the menu is being generated?

For example, if you look in your index.php file (or maybe header.php or nav.php depending how your theme is set up), is there a piece of code like this:
php wp_list_categories();

or something else?
posted by ella wren at 7:52 PM on December 21, 2010


Response by poster: It's not the WordPress native menu - and the code is in header.php (Firebug tells me that). The menu is appears to be an unordered list with nested list items, if that makes any sense. I do not see the code you mention.
posted by brownrd at 8:02 PM on December 21, 2010


Best answer: If you're using the Wordpress 3.0 navigation menus, you could setup the root level items to be custom links with a URL of # and then add the submenu items under that.

Here's a good post on Wordpress 3.0 menus.
posted by backwards guitar at 8:02 PM on December 21, 2010 [1 favorite]


Response by poster: ...and of course, my theme does not support the WordPress 3.0 menus...
posted by brownrd at 8:23 PM on December 21, 2010


Hard to tell without seeing your code.

You should really consider implementing WP's custom menu feature in your theme, it's really not that hard.
posted by XiBe at 3:18 AM on December 22, 2010


Response by poster: I found a solution - and the key was in discovering that my theme is not compatible with WordPress's built-in menus. A plugin called "Page Links To". It can be downloaded here: http://txfx.net/wordpress-plugins/page-links-to/
posted by brownrd at 5:20 AM on December 22, 2010


Yes, Page Links to is a wonderful plugin for this. Link the pages to "#".

Bonus points: If you are comfortable editing the theme, find a unique class fort he link you don't want to go anywhere (its probably in an li with a class of something like page-item-somenumber). In the CSS for your theme add some code to prevent the pointer cursor or hover effects from showing when mousing over the item that doesn't go anywhere. The lets the users know that that item is not to be clicked on.

The CSS would probably be something like this:

.page-item-somenumber a{cursor:default;}
.page-item-somenumber ul a{cursor:pointer;}
posted by cirrostratus at 9:09 AM on December 22, 2010 [1 favorite]


« Older Who covered this Lead Belly song?   |   How did you decide to do what you do? Newer »
This thread is closed to new comments.