• Hi… when setting the group criteria for a sidebar using <Pages>, I’ve noticed that the <Pages><View All> tab does not seem to return the pages in the hierarchical order defined in the WP editor for parent>sibling. I took a screenshot of what I am seeing. Should the page selections show in the proper hierarchical order?

    Oh, and really sorry if this has been answered elsewhere. I tried searching the forum, but the wp support forum is horrendous trying to search a plugin’s support threads and I just haven’t figured out how to search the support forum.

    http://screencast.com/t/IPGoD3bvvn4r

    https://wordpress.org/plugins/content-aware-sidebars/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    Thank you for your feedback.

    I have not seen this problem before, but I will look into how pages are sorted. Are you using any plugin to modify the sort order, hierarchy or status of the pages?

    Thread Starter Norm Sash

    (@normsash)

    Hi Joachim… I just tried a test and disabled all my plugins with the exception of CAS and the problem is still there.

    What’s also a little interesting: If I goto CAS [Pages > Most recent] then I do see a hierarchy of those recent pages. But if I look at CAS [Pages > View All] and look at the same tree area as in Most Recent, the page hierarchy is not displayed.

    Let me know if you want me to try anything.

    Thread Starter Norm Sash

    (@normsash)

    One more note… I’m also seeing this same behavior when looking at the hierarchical categories. It seems if looking at the “most recent” tab then the display is hierarchial, but when viewing the “all” tab it is a random display.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    I can confirm this issue and will look into it.

    Can you check whether this problem also exists when selecting pages in Appearance > Menus?

    Thread Starter Norm Sash

    (@normsash)

    From what I can tell, when I go to Appearance > Menus > Pages > Show all

    or Appearance > Menus > Categories > Show all

    it all seems to work ok.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    If you go to the Pages overview screen and sort the pages by title, is the hierarchy showing correctly?

    In my test (WordPress 4.1rc1), this, along with the Menus screen, will not show the hierarchy correctly. That can mean that the “bug” is in WordPress Core.

    Thread Starter Norm Sash

    (@normsash)

    You’re right, if I sort pages by “title” then it won’t display in hierarchical order, but then I wouldn’t expect that as it is sorting by something other than the parent / child order. But when I then click on “Pages” again in the admin pages it resorts into the proper hierarchical order. Somewhere WP is sorting on the hierarchical key order. It’s not the page ID, title, or order, but there must be some other key field it is sorting on. This is a related reference, but it’s beyond me. http://codex.wordpress.org/Function_Reference/wp_list_pages

    Also, even if I click on “Title” in pages, when I then go back to Appearance > Menu the pages are all listed in hierarchical order as expected.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    After having taken a deeper look at it, it seems like WordPress fetches _all_ pages when the hierarchy should be maintained, i.e. it is not sorting on the SQL side, but rather in the backend. This is why the hierarchy is lost/off when sorting alphabetically.

    And in the “All Pages” tab in the sidebar editor, the pages are sorted alphabetically.

    If you want to change it right now, you might be able to fix it by opening the file modules/post_type.php and look for the function meta_box_content.
    In it, $this->_get_content is called. Remove the order and orderby parameters from it. Let me know if this solves the problem.

    Thread Starter Norm Sash

    (@normsash)

    That definitely helped. I commented the order and order by parms and it improved things, but some of the hierarchy was still missing in the view all tab and the pages were scattered later in subsequent pages of the “View All” tab.

    That got me thinking that the next thing to look at was the paging. So I changed posts_per_page from 20 to 40 as shown below and that really helped. Obviously a problem when the hierarchy structure length exceeds the posts_per_page value.

    protected function _get_content($args = array()) {
    		$args = wp_parse_args($args, array(
    			'include'        => '',
    			'post_type'      => 'post',
    			'orderby'        => 'date',
    			'order'          => 'DESC',
    			'paged'          => 1,
    			'posts_per_page' => 40,
    			'search'         => ''
    		));

    Hope that helps…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How are the pages hiearchy determined?’ is closed to new replies.