Jump to content
Sign in to follow this  
michdawson

Dropdown menu list includes top level page

Recommended Posts

michdawson    0
michdawson

I'm trying to accomplish what I think is a common piece of functionality for my site, but surprisingly can't find any mention how to do it. I want to customize my dropdown menu so it includes the top level page as the first item. For example: from: About us -> Board -> Contact Us -> Directions to: About us -> About us -> Board -> Contact Us -> Directions Can this be done with an addition to the header.php? I am using EcoPro. <www.sustainablelafayette.org> thanks in advance, Michael

Share this post


Link to post
Share on other sites
catrina    103
catrina

It's possible. Go to the header.php file and look for this code:

<?php wp_list_pages('sort_column=menu_order&depth=0&title_li=&link_before=<span>&link_after=</span>'); ?>
(This controls the dropdown menu) Replace the code above with this code and then save the file:
<?php wp_list_pages('include=2,423,240,307,18,111&sort_column=menu_order&depth=0&title_li=&link_before=<span>&link_after=</span>'); ?>

(The numbers 2, 423, 240, 307, 18, and 111 are the page IDs for the top level pages)


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
michdawson    0
michdawson

Thanks for the quick reply. I did the above, including substituting the page IDs for all the top level pages, and there seems to be no change in behavior: www.sustainablelafayette.org Is there anything else I need to do? Thanks again.

Share this post


Link to post
Share on other sites
catrina    103
catrina

Hm, it's probably not adding the top level links in the submenu because they're technically already displayed as menu links. One option is to create, for example, a subpage for "About Us" and that will result in the page being added as a subpage to the menu automatically. The problem with that is that there is already a parent page called "About Us", so it'd be repetitive. Another option is to re-work the navigation menu manually, which can allow you to add the subpages you want to the submenus, but that it must be edited manually every time you add, take away, or change page links. Which option do you prefer? Also, do you want to apply the change to all of the submenus or just one?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
wairoa    0
wairoa

You could do it by creating a second [About Us] page under the top [About Us] category, then use a 301 redirect plugin to open the sub-category [About Us] page when the top level link is clicked.

Share this post


Link to post
Share on other sites
michdawson    0
michdawson

Bingo. The 301 redirect plug in works perfectly. So clean and simple without multiple pages to keep consistent or messy javascript reloads. Thanks Murray and Catrina!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×