2 Separate Menus for WordPress
-
Hello,
New to WordPress. I’d like to create a horizontal menu and a vertical menu. Each link of the menu item is for a static page. Can’t seem to figure out how to do this.
Your insight is greatly appreciated!
-
You’ll need to create 2 sidebar template files – eg: sidebar.php and sidebar-two.php. They can be called within your template files using:
<?php get_sidebar();?> <?php get_sidebar('two);?>After that it’s down to what markup and/or template tags, you choose to place within those files and your CSS.
Thanks for the quick reply!
Still having trouble with this. If I use this following code to display the horizontal menu links:
<?php wp_list_pages('title_li=')?>What should I use to display the links I want to put in the sidebar? These links have to be different from those in the horizontal menu.
Here is a follow-up to my question.
Say I have 10 static pages. I want 5 of these pages to be listed in the horizontal menu and the other 5 listed in the vertical menu.
How do I tell wp_list_pages() to list the 5 page links in the horizontal menu while listing the other 5 page links in the vertical menu?
Thanks in advance!
Use the
includeparameter to limit each list to a specific sub-group of pages – e.g.:<?php wp_list_pages('title_li=&include=3,6,9,12,23')?>Thanks esmi! This works.
However, it sounds like every time I add a new page, I have to make changes to the template file to include the newly added page in this line:
<?php wp_list_pages(‘title_li=&include=3,6,9,12,23’)?>
I was wondering if there is way to do this so I don’t have to change the template every time I add a new page.
Are there any plugins that can create separate menus at different locations of the page for different links?
Thanks again!
Not that I’m aware of. Doesn’t mean there isn’t a plugin out there somewhere that will do the job. Just that I haven’t come across it yet.
I came across something where you could sort it out on category or the likes. Looking for it right now as I need it 2. I’ll post it up here when I found it
EDIT:
It looks like it can be done in 2 ways:meta_key
(string) Only include the Pages that have this Custom Field Key (use in conjunction with the meta_value field).
meta_value
(string) Only include the Pages that have this Custom Field Value (use in conjuntion with the meta_key field).Set up a meta key (value) when creating the pages to make sure they sort in the right menu.
authors
(string) Only include Pages authored by the authors in this comma-separated list of author IDs. If no authors are specified, all authors are included.This is a bit more cumbersome but can work as well. Make 2 admin authors. one for the top menu, one for the vertical menu. Write up the pages with the correct author to sort them out.
I’d think the easiest way would be to have 1 custom field and display links in the menus depending on the value of that field.
So you could have a field named, lets say “Menu”, and give each page that field with the value of either “Side” or “Head”, and have your list pages function check that…
For the head.
wp_list_pages('meta_key=Menu&meta_value=Head')
For the side.
wp_list_pages('meta_key=Menu&meta_value=Side')
The topic ‘2 Separate Menus for WordPress’ is closed to new replies.