Support » Plugin: List Pages Shortcode » Child pages shortcode with dates sorted as DESC instead of ASC?

  • Resolved jarledb

    (@jarledb)


    [child-pages depth=”99″ sort_column=”post_date”] seem to sort by oldest to newest, instead of the other way around. Seems a bit odd? Its the opposite way of sorting than the regular post sorting.

    Any way of making it sort the other way? That is, having the newest published pages on top?

    • This topic was modified 2 years, 5 months ago by  jarledb.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ben Huson

    (@husobj)

    Hi.

    The pages are retrieved using get_pages() which by default sets the order to ASCending. Try adding the following to your shortcode to list in descending order.

    sort_order="DESC"

    Ben

    Thank you Ben, that did the trick! I couldn’t find that on the https://developer.wordpress.org/reference/functions/wp_list_pages/ page or in your description for the plugin. But I now see the first comment on the developer page has the sort_order mentioned 😀

    Plugin Author Ben Huson

    (@husobj)

    It would probably make sense for the code to automatically switch to sort order DESC if sort_column is set to post_date and no order is specified in the shortcode, but adding the order shortcode parameter works OK.

    🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Child pages shortcode with dates sorted as DESC instead of ASC?’ is closed to new replies.