Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialStu Cowley
26,287 PointsWordPress Custom Menu Sorting Alphabetically
I'm having a problem with my custom menu as it is not displaying as I have set out in the Appearance > Menus. When I get the links how I want them positioned and save the menu. Then when I go to the front-end I notice that they're displaying alphabetically instead of how I positioned them.
Have I missed something in the admin area? The code I have used for the custom menu many times before usually works as expected but not in this instance it is not working as expected.
Thanking you in advance ?
functions.php
add_theme_support( 'menus' );
function register_theme_menus() {
register_nav_menus(
array(
'main-nav' => __( 'Main Nav' )
)
);
}
add_action( 'init', 'register_theme_menus' );
header.php
// Main Navigation
$defaults = array(
'container' => false,
'theme_location' => 'primary-menu',
'menu_class' => 'main-nav'
);
wp_nav_menu( $defaults );