I am doing a html > WP convert and I am stuck on the menu.
On this page, in the menu it shows the sub nav for that page.
How would I do that using the WP drag ‘n drop menu system? I know I could create different menu’s for each page with a sub nav and use the is_page() function but is it possible using one menu?
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
You must use the wp_nav_menu function http://codex.wordpress.org/Function_Reference/wp_nav_menu and try to adapt its output to your needs, also if is better to do the opposite.
Parker
- Sold between 250 000 and 1 000 000 dollars
- Item was Featured
- Author had a Free File of the Month
- Author was Featured
- Exclusive Author
- Interviewed on the Envato Notes blog
- United States
- Microlancer Beta Tester
You just want to display the sub-pages when you are on that page only correct? You can use CSS and keep it simple. It would be something like this:
ul ul {display:none;}ul li.current-menu-item ul, ul li.current_page_item ul, ul li.current-menu-parent ul {display:block;}ParkerAndKent said
You must use the wp_nav_menu function http://codex.wordpress.org/Function_Reference/wp_nav_menu and try to adapt its output to your needs, also if is better to do the opposite. Parker
I am using wp_nav_menu, know any sites that will have a guide on how to accomplish this?
ProgressionStudios said
You just want to display the sub-pages when you are on that page only correct? You can use CSS and keep it simple. It would be something like this:ul ul {display:none;}
ul li.current-menu-item ul, ul li.current_page_item ul, ul li.current-menu-parent ul {display:block;}
Brilliant, thank you. Worked a treat
Having an issue with the css, can’t get the sub nav to display under the open menu like the link I posted above.
The link is http://www.garethgillman.co.uk/wordpress/wm/uk-visa-service/.
Any help would be appreciated.
if you need vertical style – drop down menu – and supports more than three levels, you can try jquery superfish…
http://users.tpg.com.au/j_birch/plugins/superfish/
integrating superfish with wp_nav_menu is easy,,,
wp_nav_menu( array( 'theme_location' => 'your-menu-location', 'menu_class' => 'superfish' ) );
Bump, can anyone help?
I am sure it’s a css issue but can’t find the code to make it work.
- Sold between 250 000 and 1 000 000 dollars
- Item was Featured
- Author had a Free File of the Month
- Author was Featured
- Exclusive Author
- Interviewed on the Envato Notes blog
- United States
- Microlancer Beta Tester
It looks like a simple CSS issue your having. The unordered list is open inside of your list item. I assume your CSS styles don’t account for this. The actual show/hide looks like it’s working correctly.
The UL list is showing up like so:<li><a href="">List item open</a> <ul><li><a href="">Content 2</a></li></ul></li>I fixed it (finally) but changing the code slightly.
Thanks for your help
