php - 3 Level Wordpress navigation problems -
i still fooling around dumb navigation menu. idea when first go page top level pages listed, when 1 of clicked second level menu appears below of selected pages sub pages , when 1 of pages clicked of 3rd level pages selected 2nd level page show below second level pages.
i have tried gewt done various ways, tried make session store remember parts cannot work out solution.
here have done far:
<?php wp_nav_menu(array( 'sort_column' => 'menu_order', 'theme_location' => 'primary-menu' ));// prints primary top level menu $level = count($post->ancestors); echo $level;// testing purposes if ($post->post_parent){ $children = wp_list_pages("title_li=&child_of=" . $post->post_parent . "&echo=0&depth=1"); $grandchildren = wp_list_pages('title_li=&child_of='.$post->id.'&echo=0'); } else{ $children = wp_list_pages("title_li=&child_of=" . $post->id . "&echo=0&depth=1"); } if ($children) { echo $children; } if ($grandchildren){ echo $grandchildren; } ?>
here problem having. works 1 way, if click on top level second level appear, if click second level 3rd level appear when click 3rd level second level disappears.
this driving me nuts! have spent day on reading get_post get_children etc etc etc.
thanks,
c
here solution menu sub-menu , sub-menu of submenu....etc.
i call menu this:
<?php $defaults = array( 'theme_location' => '', 'menu' => 'topmenu', 'container' => 'ul', 'container_class' => 'topmenu-{topmenu slug}-container', 'container_id' => 'topmenu', 'menu_class' => 'topmenu', 'menu_id' => 'topmenu-{topmenu slug}[-{increment}]', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'depth' => 0, 'walker' => ''
); ?>
this menu using simple topmenu class. ok, here css can customized wish.
.topmenu{ border:none; border:0px; margin:0px; padding:0px 0px 0px 10px; font-family:arial, serif; font-size:10px; list-style-type:none; } .topmenu ul{ height:20px; list-style:none; margin:0; padding:0; } .topmenu li{ float:left; padding:0px; list-style-type:none; } .topmenu li a{ background-color:#000000; color:#6699cc; display:block; line-height:20px; margin:0px; padding:0px 10px; text-align:center; text-transform:uppercase; letter-spacing:-1px; text-decoration:none; list-style-type:none; border-right:1px solid #666666; } .topmenu li:first-child { border-left: none; } .topmenu li:last-child a{ padding-right:0; border-right:none; } .topmenu li a:hover { color:#00ccff; text-decoration:none; list-style-type:none; }
i hope you.
Comments
Post a Comment