• Hello,

    I am using the following PHP code (that i did not write) to display a custom menu on my homepage (https://www.globexposure.net/blossoms/):

    <?php wp_nav_menu( array( 'theme_location' => 'home-menu', 'container_class' => 'home_menu_class' ) ); ?>

    At present it displays the menu items in reverse alphabetical order.

    I would like to sort the array into datetime order instead. Please can someone show me how?

    Many thanks

Viewing 1 replies (of 1 total)
  • Hi

    Looking at:

    https://codex.www.ads-software.com/Function_Reference/wp_nav_menu#Parameters

    There is not an option to sort menu items.

    Secondly, menu items do not have a date/time associated with them. So even if you could sort, you could not sort by the date/time.

    However, try this:

    1)
    Have you tried editing the menu and changing the order of the menu items?

    2)
    If these are all pages, edit each page and set Page attributes (Box on right side of editing screen) > Order for each page…

    Hope this helps ??

Viewing 1 replies (of 1 total)
  • The topic ‘Sort PHP array by datetime’ is closed to new replies.