WordPress.org

Ready to get started?Download WordPress

Forums

Implemented Navigation Menus in old template, and now menu is in reverse order (5 posts)

  1. josee225
    Member
    Posted 1 year ago #

    Hi,
    I am kinda new to WordPress, and I am helping out a friend. We want to implement the Navigation Menus in his template in order to have more control.

    Here is what I added in the funcions.php file:

    function register_my_menus() {
      register_nav_menus(
        array(
          'header-menu' => __( 'Header Menu' ),
          'footer-menu' => __( 'Footer Menu' )
        )
      );
    }
    add_action( 'init', 'register_my_menus' );

    and here is what I added in the header.php template:

    <?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'container' => '', 'orderby' => 'menu_order', 'order' => 'ASC' ) ); ?>

    The menu shows up, but in reverse order! Is there any way to fix this?

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Have you checked the Codex Function Reference for wp_nav_menu arguments? Focus on menu_order.

  3. josee225
    Member
    Posted 1 year ago #

    Hi, thanks for the quick answer!

    Yes i did check the Codex before posting my question. In fact, I even tried 'sort_column' => 'post_title' just to see if it would change anything, but the menu stays the same, nothing changes...

    I checked in the functions.php file if there was anything else about menus, but there is only the code I added this morning.

    Is there anywhere else in a template where this can be set?

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    Is there an order being set on the page attributes section, when you edit a page in the dashboard?

  5. josee225
    Member
    Posted 1 year ago #

    I just double-checked and there is no order, everything is at 0 in the Page Attributes.

Topic Closed

This topic has been closed to new replies.

About this Topic