CMS Tree Page View
[resolved] Orderby should include post_title (6 posts)

  1. borisdivjak
    Posted 3 years ago #

    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!


  2. Pär Thernström
    Plugin Author

    Posted 3 years ago #

    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.

  3. borisdivjak
    Posted 3 years ago #

    Great, thanks!

  4. Andrew Miguelez
    Posted 3 years ago #

    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.

  5. Eric
    Posted 2 years ago #

    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.

  6. Pär Thernström
    Plugin Author

    Posted 2 years ago #

    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 :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • CMS Tree Page View
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic