Support » Plugin: CMS Tree Page View » Orderby should include post_title

  • Resolved borisdivjak


    I noticed that the default WordPress way of ordering hierarchical post types is by “menu_order, post_titlte” and not by menu_order only. I assume it would be a good idea to implement the same method in TPV, so that the order in the default page list view and the tree view would be the same.

    Love the plugin otherwise, keep up the good work!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Pär Thernström


    I agree, if wp does order by post_title as second order by this plugin should do the same. i’ll add that to the next update.

    Great, thanks!

    The plugin currently does not show pages in the same order in tree view as WordPress does on the front-end. If I output the page list, it will display in alphabetical order unless any pages have had their order set. If I understand your proposed addition to the next update, you will match WP in how you display the order of pages in tree view.

    However, what will you do about reordering pages? If I drag and drop a page in a branch of unordered pages (all page orders still set to ‘0’), will TPV still show that the page has been reordered as it does now? Technically, TPV is only applying an order number to the affected pages. Shouldn’t it apply an order number to everything in the branch so that the front-end matches the tree view?

    I realize this is very confusing, but I was confused when I tried reordering pages today and noticed that the front-end wouldn’t match until I manually reordered each page at least once.



    Huh, I guess I’d never noticed that TPV reorders the menu order if I drag items. Interesting.

    Instead I’ve been frustrated that TPV uses the menu order instead of allowing itself to be sorted by ‘title’ or ‘date’.

    To resolve that, I’ve added a global variable $cms_tpv_orderby to cms_tpv_get_pages() and then change the arguments array so that "orderby" => $cms_tpv_orderby ? $cms_tpv_orderby : "menu_order", instead of just defaulting to menu_order. This way I can override the sort order by simply setting the global $cms_tpv_orderby = 'title' (for example) in my own functions.php file.

    This works fine (except that I have to recreate it after each update). I was going to ask that this be moved into the core plugin itself, but now I realize this might make a big mess of the reordering that TPV does based on menu_order. Since I never tried that, I never noticed.

    Hm. Not sure what is right now. I sure do find my long lists of page much easier to navigate in title order, but that would make reordering a bit nonsensical. Maybe if a few options were built in to TPV, it could turn off the reordering when other orderby options were in force.

    Plugin Author Pär Thernström


    If you want to modify the functionality perhaps you could add a filter for that functionality? Then all user can benefit from your approach if they want to.

    I don’t have time to look at this at the moment, but feel free to send me any code if you modify it 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Orderby should include post_title’ is closed to new replies.