• Resolved schaefermic

    (@schaefermic)


    Im using the wp_page_menu command to display the list of all pages I have on the my site on a template page. The only issue is that when i sort by post_date, it displays the oldest first, instead of the newest page.
    Currently I’m using:

    <?php wp_page_menu( array( 'sort_column' => 'post_date' ) ); ?>

    Is there any to reverse this order? im no php wizard.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter schaefermic

    (@schaefermic)

    anyone know if there is a fix for this?

    Even though it is not shown in the Codex, I think you can use this:

    <?php wp_page_menu( array( 'sort_column' => 'post_date', 'sort_order' => 'ASC' ) ); ?>

    The documentation for wp_list_pages, which is called by wp_page_menu, says that ‘ASC’ is the default, so you might also try ‘DESC’. That sounds wrong to me because older dates ought to be smaller but maybe post_date is being recalculated to mean post_age.

    Thread Starter schaefermic

    (@schaefermic)

    Ahhh, that’ll do it!

    DESC got it to start with the newest.

    Thanks SO much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Reverse sort order of wp_page_menu’ is closed to new replies.