WordPress.org

Ready to get started?Download WordPress

Forums

Hierarchical Pages Widget
[resolved] Sort not working (12 posts)

  1. mlblanchard
    Member
    Posted 2 years ago #

    Using the Hierarchical Pages Widget, checking the "Sort in menu order (else alphabetical)" box has no effect. The menu sorts alphabetically whether this box is checked or not. Any known issues that would cause this? Unfortunately I can't link to my site, because it's a client site in development they're not ready to expose to the public.

    Thanks,

    Michael

    http://wordpress.org/extend/plugins/hierarchical-pages/

  2. wlindley
    Member
    Plugin Author

    Posted 2 years ago #

    Did you get this working?

  3. mlblanchard
    Member
    Posted 2 years ago #

    Yes! I can't remember now what the exact issue was, but I think it was user error - my error, that is. :)

  4. lalcala
    Member
    Posted 2 years ago #

    I'm having the same issue. I checked to be sure that the box to sort in menu order is checked, but the pages keep showing up in alpha order. Can anyone help?

    Thanks!

  5. lalcala
    Member
    Posted 2 years ago #

    By the way, I'm using WP 3.2.1 with the Genesis theme (child theme - Associate). Like Michael, I'm unable to provide the link to the client site at this point.

  6. wlindley
    Member
    Plugin Author

    Posted 2 years ago #

    On about line 184 of hierpage.php you will see:

    $this->hierpages_list_pages($page_options);

    Immediately before this could you please insert the line:

    print "<hr>"; print_r($page_options); print "<hr>";

    and paste here what gets output between the horizontal rules?

  7. lalcala
    Member
    Posted 2 years ago #

    Thanks so much for your quick response. I'll try this and will report back. When you refer to output, do you mean what I see on the site after I've made this change?

  8. lalcala
    Member
    Posted 2 years ago #

    This is what I see in my sidebar after updating the php file.

    show_siblings=yes&show_root=&show_home=&child_of=&sort_column=menu_order,post_title

  9. wlindley
    Member
    Plugin Author

    Posted 2 years ago #

    OK, that shows the plugin is asking WordPress to list the pages by menu_order first and post_title second. Perhaps your theme is interfering somehow. Please contact me directly at bill@saltriversystems.com to see what else we can do to find the problem.

  10. tamayo
    Member
    Posted 2 years ago #

    A quick solution is to hardcode the sort order in the plugin file hierpage.php. Basically, the only option would be sorting by menu order. Around line 197, change

    if ($instance['menu_order'] == 'yes') {
    $page_options['sort_column']='menu_order,post_title';
    } else {
    $page_options['sort_column']='post_title';
    }

    to

    if ($instance['menu_order'] == 'yes') {
    $page_options['sort_column']='menu_order';
    } else {
    $page_options['sort_column']='menu_order';
    }
    I have not looked at the file carefully but it is possible the sort options on the widget are not being passed along. Also, if you upgrade the plugin, this change will be lost.

  11. lalcala
    Member
    Posted 2 years ago #

    Yaaayyyy, Tamayo! That worked. Fortunately I had the original plugin php that I was able to modify with your code. Thank you so much!

    Bill, I appreciate your help with this, as well. I'm now running the older version of the plugin, but if another fix comes out, I'll upgrade.

  12. wlindley
    Member
    Plugin Author

    Posted 2 years ago #

    In version 1.1 you should be able to set the sort column to just menu_order ... although, really, menu_order,post_title should sort first by the menu order and only use the title within groups of pages with the same value for menu_order.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic