WordPress Menu: Menu items are added by latest items first

Good Day

I am using a wordpress theme, and theme is adding menu items and ignores the WordPress menu editor. The way it adds menu’s is like this:

Read More

It adds all pages to the menu, and in the order you add the page – So if you want the first menu item to be last, you have to delete its page, and add it again – then it will appear as the last menu item.

How can I prevent this from happening and have control over my menu items?

relevant code – all places where the containing ‘ul.dropdown’ hosting the menu items appear:

functions.php:

// Add ID and CLASS attributes to the first <ul> occurence in wp_page_menu
function add_menuclass($ulclass) {
return preg_replace('/<ul>/', '<ul class="reset dropdown">', $ulclass, 1);
}

and

dropdown.php – the whole file

<?php wp_nav_menu(array( 'theme_location'  => 'primary', 'sort_column' => 'menu_order', 'menu_class' => 'nav-menu', 'container_class' => 'nav-menu',) ); ?>

<div class="clear"></div>

Related posts

Leave a Reply

2 comments

  1. I’m assuming you’re running WprdPress 3.0 or higher. For starters you ought to have add_theme_support( 'menus' ); in your functions.php file this tells WordPress that the theme supports custom menus.

    Then in order to display your menu, you would actually instruct WordPress to use the menu. using something similar to the following. You need to add the following code wherever you want the menu to appear.

    <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>
    

    wp_nav_menu is the main function at work. The arguments sort_column tells WordPress to follow the order you pick in the options panel, and the argument container_class refers to the the CSS class that you assign to the menu.

    Note that if you are using more than one menu (you may want to have a header and a footer menu for instance), you need to let WordPress know how to identify the menu in question. You can do this by specifying either the menu ID, menu slug, or menu name using the following parameters $id, $slugor $menu.

    I hope that helps. Should you wish to read more about this the WordPress Codex is a great place to start.

    Regards,
    Ian

  2. Is there any chance to be a plugin that you have?

    Also there are some issues with the uploading in wordpress you must be carefull.

    Do you use any ftp or do you do the changes at the editor of wordpress?