How to highlight current menu items (4 posts)

  1. marion1203
    Posted 2 years ago #


    I just started WordPress and I'd like to enhance current menu items. Ive tokena look on every posts about about that but im still stuck. So here is my php code forthe menu ( I have submenu):

    <div class="menu">
    			<?php wp_nav_menu(array(
    			'theme_location' => 'nav',
    			'menu' => 'header',
    			'depth'=> 1,
    			); ?>
    <div class="submenu">
    <ul><li> <a>
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      echo $children;
    </a> </li> </ul> </div>

    and here is the class I want for current menu items :

    .menu ul li .selected {
    	color: #336699;
    	border-left: 1px dotted #999999;
    .submenu ul li .selected {
    	color: #336699;
    	border-left: 1px dotted #999999;

    Could someone help me with that?

    Thank you very much

  2. the menu codes output their own 'current' css classes;
    for instance:


  3. marion1203
    Posted 2 years ago #

    Thank for you quick answer, actually I already tried to replace the class selected by current-menu-item, but it didn't work either. that is why I tought there is a problem n my php code. Well actually I dont really know.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Try using Firefox with the Firebug add-on for this kind of CSS work.

Topic Closed

This topic has been closed to new replies.

About this Topic