Forums

How to highlight current menu items (4 posts)

  1. marion1203
    Member
    Posted 10 months ago #

    Hi!

    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>		
    
    <div class="submenu">
    <ul><li> <a>
    <?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");
    
      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. alchymyth
    The Sweeper & Moderator
    Posted 10 months ago #

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

    http://codex.wordpress.org/Function_Reference/wp_nav_menu#Menu_Item_CSS_Classes

  3. marion1203
    Member
    Posted 10 months 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
    Theme Diva & Forum Moderator
    Posted 10 months ago #

    Try using Firefox with the Firebug add-on for this kind of CSS work.
    http://getfirebug.com/

Reply

You must log in to post.

About this Topic