How to get wordpress menu’s working.
Add this to your stylesheet:
/** submenu **/
#menucontainer ul li.hover, #menucontainer ul li:hover {
position:relative;
}
#menucontainer ul li.hover ul, #menucontainer ul li:hover ul {
display:block;
}
#menucontainer ul li.hover ul ul, #menucontainer ul li:hover ul ul {
display:none;
}
#menucontainer ul ul {
position:absolute;
top:38px; /*how far away from the top menu*/
left:0;
margin:0;
padding:5px;
width:200px;
display:none;
background-color:#4D391E; /*color of the dropdown*/
z-index: 100;
}
#menucontainer ul ul li {
width:200px;
margin:0;
border: 0;
}
#menucontainer ul ul a {
display:block;
float:none;
width:180px;
border:none;
padding:10px 10px;
background:none;
font-size:16px; /*font size */
line-height:14px;
color:#493215;
border: 0;
border-bottom:1px solid #998260;
text-transform:none; /*turns off the uppercase*/
}
#menucontainer ul ul li.hover a, #menucontainer ul ul li:hover a, #menucontainer ul ul a:hover {
color:#ff6826;
}
#menucontainer ul li.hover a,
#menucontainer ul li:hover a,
#menucontainer ul a.active,
#menucontainer ul a:hover {
color:#ff6826; /*color of text on mouse over*/
}
#menucontainer ul li:hover > ul {
display: block;
}
#menucontainer .current-menu-item > a,
#menucontainer .current_page_item > a,
#menucontainer .current_page_ancestor > a {
color:#ff6826 !important; /*color of text on current over*/
}
Remove the current menu from header.php (ie: everything inside <div id="menucontainer">) and replace it with this code:
<?php wp_nav_menu( array( 'theme_location' => 'main-menu' ));?>
add this code to the top of your functions.php file:
add_action( 'init', 'dtbaker_theme_init' );
function dtbaker_theme_init() {
register_nav_menus(
array(
'main-menu' => __( 'Main Menu' ),
)
);
}
// hack for menu.
function dtbaker_wp_nav_menu_items($items,$args){
if(preg_match_all('#<a>]*title="([^"]+)"[^>]*>[^<]*#',$items,$matches)){
foreach($matches[0] as $key=>$val){
$items = preg_replace('#'.preg_quote($val,'#').'#',$val.'<br /><span>'.$matches[1][$key].'</span>',$items);
}
}
return $items;
}
add_action('wp_nav_menu_items','dtbaker_wp_nav_menu_items',10,2);
</a> 

306 Purchases
81 Comments