List WordPress pages in custom order

Step 1: Paste this code in the template file where you want the list of pages to appear.



$args = array(
‘authors’      => ”,
‘child_of’     => 0,
‘date_format’  => get_option(‘date_format’),
‘depth’        => 3,
‘echo’         => 1,
‘exclude’      => ”,
‘include’      => ”,
‘link_after’   => ”,
‘link_before’  => ”,
‘post_type’    => ‘page’,
‘post_status’  => ‘publish’,
‘show_date’    => ”,
‘sort_column’  => ‘menu_order, post_title’,
‘walker’       => ”,
‘sort_order ‘  => ‘DSC’    ,

wp_list_pages( $args );




This piece of code will print all the pages in your WordPress site in the order you want.


Step 2: To specify the order for a page, you will have to edit each page. On the edit page screen you will find the page attribute section there you have to edit its menu order, as shown in the image below.


The pages will list there as per the menu order in Ascending order which means that the page with lower menu order number will appear before the page with higher menu order.


Leave A Comment