Pretty much a shot in the dark, to perhaps get a minute from you someone to answer a question about having a two-tiered navigation menu on a site I am making for a non profit.
Following Darren Hoyt's blog post at
http://www.darrenhoyt.com/2008/02/12/creating-two-tiered-conditional-navigation-in-wordpress/
I am trying my best to make it work and it simply wont take.
http://www.rockridgelocal.com/for-residents/
(This is pretty much what happens, it just lists everything.)
I figure that it might be because I am using Wordpress 3. Perhaps this code its
not meant for WP3. So I was wondering if there was a way to modify it to work
with the Wordpress 3 Custom Menu .
I have looked for days and it seems that many people have the same question and
for the most part they end up unanswered.
I'd really appreciate if someone to helps me.
I just need to know how to modify this one to put on the header and maybe something in functions and make it work with WP3 and its custom menu.
No plugins.
A.
designchemical answers:
You can use CSS to create a 2-tiered menu where the child sub-menus only appear when the menu item is the current page. This uses the built-in menu classes that Wordpress 3.0 adds to custom menus. See the following tutorial:
[[LINK href="http://www.designchemical.com/blog/index.php/wordpress-tips/wordpress-tutorial-current-parent-menu-items-in-custom-menus/"]]http://www.designchemical.com/blog/index.php/wordpress-tips/wordpress-tutorial-current-parent-menu-items-in-custom-menus/[[/LINK]]
Antonio comments:
It not working for me right now because I am not using...
<div class="access">
<?php wp_nav_menu(); ?>
</div>
What I am trying is this...
<ul id="nav">
<?php wp_list_pages('title_li=&depth=1'); ?>
</ul>
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children && is_page()) { ?>
<ul id="subnav">
<?php echo $children; ?>
</ul>
<?php } else { ?>
<?php } ?>
How should I set up the menu on my header for this CSS to work?
A.
designchemical comments:
Then you arent using the WP menu system. If you switch it to wp_nav_menu you can use the built-in classes
Antonio comments:
Cool! It worked. Thank you. I need to now work on the CSS. Great post by the way!
designchemical comments:
Thanks. Glad it solved the problem!
Fahad Murtaza answers:
I can help you. If you can send me FTP details by PM. I have done such fixes many times before. This would be fun.
Fahad Murtaza comments:
Its CSS and some event js code. I can quickly fix it.
Fahad Murtaza comments:
and wordpress 3 has nothing to do with it. I will use built in wordpress API code for generating menus. And will do filters if necessary for output formatting.
Fahad Murtaza comments:
I see
You are using this theme
http://aquoid.com/news/themes/suffusion/
and I am downloading this theme and trying to make it work. Stay tuned.
Antonio comments:
Were you able to figure it out?
Hai Bui answers:
Hi,
I've done this recently with css only. If you give me WP admin info, I will help you do it.
Do you use wp_nav_menu to display the menu?
Antonio comments:
I do not have permission to give out admin privileges.
Antonio comments:
I could use <?php wp_nav_menu(); ?>
However I am trying to use Darren Hoyt's blog post at
http://www.darrenhoyt.com/2008/02/12/creating-two-tiered-conditional-navigation-in-wordpress/
So right now what I have is...
<ul id="nav">
<?php wp_list_pages('title_li=&depth=1'); ?>
</ul>
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children && is_page()) { ?>
<ul id="subnav">
<?php echo $children; ?>
</ul>
<?php } else { ?>
<?php } ?>
Hai Bui comments:
Are you sure you know how it will work following this tutorial (Darren Hoyt's blog post)? The submenu will only show when the current page (the page being viewed) has child pages, and it will show those child pages as submenu items.
Julio Potier answers:
Please @all_experts : before closing the question, paste your solution here.
Thank you
Antonio comments:
It not working for me right now because I am not using...
<div class="access">
<?php wp_nav_menu(); ?>
</div>
What I am trying is this...
<ul id="nav">
<?php wp_list_pages('title_li=&depth=1'); ?>
</ul>
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children && is_page()) { ?>
<ul id="subnav">
<?php echo $children; ?>
</ul>
<?php } else { ?>
<?php } ?>
How should I set up the menu on my header for this CSS to work?
A.
Antonio comments:
Opps.. that was not for you.
Jatin Soni answers:
There is no need to do any conditional for this menu. I have just done few days ago and works fantastic without any kind of issue.
Just give me the access I will do if for you. I need only few hours to fix it.
Antonio comments:
I do not have permission to give out admin privileges.