WordPress.org

Ready to get started?Download WordPress

Forums

Menu_id and menu_class will not work properly with wp_nav_menu(); (4 posts)

  1. Jonas
    Member
    Posted 2 years ago #

    According to wordpress.org - Function Reference/wp_nav_menu the menu_id and menu_class will give the ul an id and/or a class. For some reason it doesn't.

    header.php:

    <?php wp_nav_menu( array( 'theme_location' => 'primary-menu', 'menu_id' => 'nav', 'menu_class' => 'clearfix', 'show_home' => '1' ) ); ?>

    functions.php:

    <?php
    add_action( 'init', 'register_my_menu' );
    function register_my_menu() {
    register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );}
    ?>

    The menu_class creates a div with the given classname and wraps it around the ul while the menu_id doesn't seem to have an effect at all. I want to give the ul an id and a class. In advance, thanks.

  2. Jonas
    Member
    Posted 2 years ago #

    I've solved it. Read this post if you have a similar problem.

  3. shahidkarimi
    Member
    Posted 2 years ago #

    Hey @Jonas, on visiting the link you posted there is no solution at all? Why you post the link if you did not read that post? Huh

  4. Digital Raindrops
    Member
    Posted 2 years ago #

    @shahidkarimi,
    Why are you asking questions in a topic from 8 months ago, if you have a question start a new topic!

    There have been new releases in the last eight months with many issues resolved, so it is likly not a problem now!

    David

Topic Closed

This topic has been closed to new replies.

About this Topic