Creating a custom order
-
Hello Angelo,
Thanks a lot for this plugin! It does exactly what it should and it’s super easy to use.I have one question: is it possible to create a custom order? On my website it seems to order the pages alphabetically, bit I found this demo in the documentation:
where the top example seems to have a custom order. How did you achieve this?
(I did find some other posts/questions about a custom/different order, but these posts are around 10 years old.. so I am not sure if the answer is still reliable)Thanks already, Jip
The page I need help with: [log in to see the link]
-
Hello Jip,
Thanks for those kind words!
When you do not specify a
sort_columnor if specify the column “menu_order” the items will be ordered by the menu_order value in ascending order, unless they are all set to 0’s then it falls back to sorting by the page title.Here is my trick, I use the CMS Tree Page View plugin by Pär Thernström. In the Tree View I drag/drop the pages in the order I want, it will swap the “menu_order” numerically to make the pages sort how I wanted.
This identified a mistake with the documentation. In my plugin it says that the sort_column default is “post_title”, it is actually “menu_order, post_title” (first menu_order, then post_title). This is copied from the source wp_list_pages() function which also has the
sort_columnin the documentation parameters list has Default ‘post_title’. Again this is incorrect, the actual default is ‘menu_order, post_title’. I reported the typo to the ww.wp.xz.cn team and will fix it in my plugin on the next update.Thanks,
Angelo
You must be logged in to reply to this topic.