• I want to create a sitemap that lists pages alphabetically in ascending order and numerically descending eg:-

    abc
    bcd
    cde 2020
    cde 2019
    cde 2018
    def (etc….)

    Using the sort_order argument I can create a list that is either “ASC” or “DESC” but this doe not give me the required result.

    Is there any way to mix the sort method to combine ascending and descending criteria?

    Any help gratefully received.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was going to say to use multiple sort_order values, but the code won’t let you. SQL would handle it, but the get_pages function has this code:

    if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ), true ) ) {
      $sort_order = 'ASC';
    }

    I suppose you could do your own SQL instead.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Or fetch them into an array and use one of the many PHP sort-related functions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_list_page sorting’ is closed to new replies.