php - How do I get wp_nav_menu to stay expanded when I navigate to submenu items? -


i new arrival in wordpress community , working on trying convert static html site on wp platform. have in theme working 1 exception: navigation menu.

i trying use built in navigation functionality, , pretty sure have seen done on other wp sites, i'm having hard time finding guide me through area (i apologize if there ask scenario on stackoverflow, i've been searching few days , maybe i'm using wrong terminology?).

this testing base: http://ahathaway.n120.fiercethought.net/consumer-support/

that link take section on website supposed have "sub-menu" , trying accomplish having submenu stay expanded if , when user navigates of sub-menu items (i.e. if click "membership forms" sub-menu shouldn't disappear currently).

i'm not sure i'm missing here exactly, , i'm in desperate need of nudge in correct direction, @ , appreciated! thanks!

here relevant code (please let me know if need/want see else, tried keep post concise, @ least initially):

from header.php:

 <!-- begin navigation menu -->       <?php                                 // top navigation menu                                 wp_nav_menu( array(                                     'theme_location' => 'top-navigation',                                                                            'menu_id' => 'nav',                                     'menu_class' => 'left',                             'depth' => 2,                 'walker' => new walker_nav_menu));   ?>     <!-- end navigation menu --> 

here style.css (since conversion , needs close identical possible, of css has been left intact:

    /* following reset.css housed */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {     margin: 0;     padding: 0;     border: 0;     outline: 0;     font-weight: inherit;     font-style: inherit;     font-size: 100%;     font-family: inherit;     vertical-align: baseline; } /* remember define focus styles! */ :focus {     outline: 0; } body {     line-height: 1;     color: black;     background: white; } ol, ul {     list-style: none; } /* tables still need 'cellspacing="0"' in markup */ table {     border-collapse: separate;     border-spacing: 0; } caption, th, td {     text-align: left;     font-weight: normal; } blockquote:before, blockquote:after, q:before, q:after {     content: ""; } blockquote, q {     quotes: "" ""; }  /* following css came screen.css original website  */   body {background: #3279b3; color: #333; font: 13px/17px "lucida sans unicode", "lucida grande", verdana, arial, helvetica, sans-serif;} strong {font-weight: bold;} p {margin: 10px 0;} p.small {font-size: 11px; line-height: 14px; color: #666;} label {font-weight: bold;} input, textarea {margin: 5px 0 10px 0; font-family: "lucida sans unicode", "lucida grande", verdana, arial, helvetica, sans-serif;} textarea {width: 500px; height: 100px; font-size: 11px; padding: 5px;} {color: #738403; font-weight: bold;} hr {margin: 20px 5px; border: none; border-bottom: 1px solid #bed6e9; clear: left;} * + html hr{margin: 10px 5px 0 5px; padding: 0; border: none !important; line-height: 1px; color: #bed6e9;}  #wrapper {width: 100%; margin: 0 auto; background: url(/_assets/bg_body.png) top center repeat-y;}  #cols {width: 930px; margin: 0 auto; background: url(/_assets/bg_cols.png) 0 0 no-repeat; position: relative; overflow: auto; padding: 0 15px 10px 15px;}  #cols img.bnr {float: left; margin-bottom: 18px}  #topbar {height: 50px; width: 708px; position: absolute; top: 0; right: 14px;} #topbar form {float: right; margin-top: 11px; background: url(/_assets/bg_search.png) 0 0 no-repeat; width: 175px; height: 28px;} #topbar input {background: none; border: none; margin: 0;} #topbar input.box {width: 130px; color: #c8e6ff; padding: 6px 0 6px 8px; font: 11px "lucida sans unicode", "lucida grande", verdana, arial, helvetica, sans-serif; height: auto; line-height: 11px;  vertical-align: top;} #topbar input.button {     width: 34px;     height: 26px;     font-size: 1px;     text-indent: -999em;     cursor: pointer; }  #weather {float: left; margin-top: 4px; font-size: 12px;} #weather ul, #weather li {display: inline; line-height: 40px; color: #fff;} #weather img {float: left; margin-right: 3px;}  #col_lft {width: 215px; float: left; background: url(/_assets/bg_nav.png) bottom center no-repeat;}  #nav {width: 215px;} #nav li a, menu-item {color: #fff; font-size: 13px; text-decoration: none; height: 35px; line-height: 37px; width: 185px; padding: 0 15px; display: block; border-top: 1px solid #416788; border-bottom: 1px solid #17354e; font-weight: normal;} #nav li a:hover, #nav li.current_page_item a, #nav li.parent-here {color: #76d3ff; background: url(/_assets/bg_nav_hover.png) top center no-repeat; border-top: 1px solid #17354e;} #nav li ul {display: none; margin: 0; padding: 0;} #nav li ul li {border: 0 !important;} #nav li.current_page_item ul, #nav li.parent-here ul {display: inline !important;} #nav li.current_page_item ul li a, #nav li.parent-here ul li { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;} #nav li ul li a:hover, #nav li ul li a:active, #nav li.parent-here ul li.current_page_item { background-image: none !important; color: #259fd2; } #nav li.last a, #nav li ul li.last a, #nav li ul li.herelast {padding-bottom: 3px; border-bottom: none !important;} #nav li ul li.last {padding-bottom: 12px;} #nav li.herelast {background: url(/_assets/bg_nav_hover_bot.png) bottom center no-repeat; border: none !important; padding-top: 1px; padding-bottom: 3px;} #nav li.last a:hover {background: url(/_assets/bg_nav_hover_bot.png) bottom center no-repeat;} #nav li.herelast, #nav li.herelast {color: #259fd2 !important;} * + html #nav li ul {float: left; margin-left: -16px;}  #col_rht {width: 700px; float: right; margin-top: 65px;} #col_rht h1 {font-size: 24px; font-weight: bold; color: #d87500; margin: 6px 5px 15px 5px; padding-bottom: 22px; line-height: 24px; border-bottom: 1px solid #88abc7;} #col_rht h2 {font-size: 15px; line-height: 18px; font-weight: bold; margin: 20px 5px 10px 5px;} #col_rht h3 {font-weight: bold; margin-top: 20px;} #col_rht h3, #col_rht p, #col_rht ul, #col_rht ol, #col_rht table, #col_rht blockquote {margin: 10px 5px;} #col_rht table {width: 690px;} #col_rht table, td {border: 1px solid #b9d7ef; border-collapse: collapse;} #col_rht td {padding: 6px 8px; line-height: 15px;} #col_rht tr.odd {background: #dff1ff} #col_rht ol li {     list-style: decimal;     margin-left: 20px;     margin-bottom: 5px; } #col_rht ul li {     list-style: disc;     margin-left: 20px;     margin-bottom: 5px; } #col_rht {     color: #008ec9;     font-weight: bold; } #col_rht img.flt_lft {float: left; margin: 0px 15px 15px 5px;} #col_rht img.flt_rht {float: right; margin: 5px 5px 15px 15px;} #col_rht blockquote {background: #dff1ff; padding: 1px; border-left: 5px solid #82b0d4;} #col_rht blockquote p {margin: 10px; padding: 0;}  #buckets {width: 700px; overflow: auto; background: url(/_assets/bg_buckets.png) 0 0 repeat-y; font-size: 12px;} #buckets div.bucket {width: 202px; margin-right: 30px; float: left; padding: 0 5px; overflow:visible} #buckets div.bucket.last {margin-right: 0; position:inherit} #buckets h2 {font-size: 18px; font-weight: bold; color: #e07c06; margin: 0 0 12px 0; padding-bottom: 15px; line-height: 20px; border-bottom: 1px solid #bed6e9; line-height: 16px;} #buckets h3 {font-weight: bold; margin: 10px 0;} #buckets p {margin: 10px 0 0 0;} #buckets label {margin-left: 10px;} #buckets input {width: 195px;} #buckets input.submit {margin-bottom: 0; width: 60px;}  #footer {width: 100%; height: 50px; margin: 0 auto; background: url(/_assets/bg_footer.png) bottom center no-repeat; padding-bottom: 40px;} #footer p {margin: 0; padding: 15px 0 0 0; font-size: 11px; color: #666; line-height: 15px; text-align: center;} 

there class called current_page_item responsible menu expansion. class present in li#menu-item-30 in link gave. however, current_page_item absent , replaced current_page_parent subpages. that's why it's not showing.

therefore, recommend in stylesheet, duplicate every dom identifier uses current_page_item, , put current_page_parent in place. here mean:

before:

#nav li.current_page_item ul li a, #nav li.parent-here ul li { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;} 

after:

#nav li.current_page_parent ul li a, #nav li.current_page_item ul li a, #nav li.parent-here ul li { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;} 

do every instance of current_page_item find, , should go.

by way, using firebug or chrome/safari developer tools? invaluable debugging these types of problems. that's did. :)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -