WordPress.org

Forums

nav menu theme with css current page selected - 07.20.12 (4 posts)

  1. mrjap1
    Member
    Posted 3 years ago #

    Hello All,

    I have a navigation menu that I created in wordpress. It shows up on each page and the navigation works well taking me to all my pages.

    I have a special CSS style for showing the selected / current page for the visitor the page they are currently on.

    I wanted to know the best way I can get this to work in wordpress.

    thanks
    mrjap1

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    if you are using wp_nav_menu() then this will output '.current...' css classes:

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

  3. mrjap1
    Member
    Posted 3 years ago #

    Hello alchymyth,

    Thank you for your help... I very much appreciate it.
    This is the code in my functions.php that I'm using to power my menus.

    How would I integrate or use new a php code to get my selected / current page to show? What do you suggest?

    //Navigation
       add_action('init','register_custom_menu');
       function register_custom_menu(){
       register_nav_menu('custom_menu',__('Custom Menu'));
       }
    
      //Footer Navigation
       add_action('init','register_custom_menu');
       function register_custom_foot_menu(){
       register_nav_menu('custom_foot_menu',__('Custom Footer Menu'));
       }

    thx
    mrjap1

  4. Andrew Bartel
    Member
    Posted 3 years ago #

    There should be a current-menu-item class added the list item, you can use that to add styles.

    Edit: Oops, alchymyth already the question. Use css, not php in this case man.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.