Ordering By Menu Order Seems To Be Ignored
-
Hi,
I’m using v1.1 of Next/Previous Page Link Plus, on a self hosted WP v3.4.2 installation. My rationale behind using the plugin is to cut down on the need to navigate between ‘chapters’ of my plugin’s documentation on my site.
I’ve got previous and next page navigation working well in a custom page template and I’m specifying
order_by
to bemenu_order
but this appears to be ignored and the default behaviour oforder_by
(post_title
) seems to be used regardless.You can see this on my site here: https://www.vicchi.org/codeage/wp-biographia/bending-wp-biographia-to-your-will-a-configuration-guide/
The previous link, by menu order should be https://www.vicchi.org/codeage/wp-biographia/ (the parent), the next link, by menu order, should be https://www.vicchi.org/codeage/wp-biographia/hacking-wp-biographias-appearance-with-css/.
But instead, it looks like the order is by post title alphabetically. Unless I’m drastically mis-reading what
menu_order
should do.I’ve gone through the usual sort of checks, reverting my theme back to a stock TwentyTen and seeing if the fun recurs, as well as deactivating all other plugins … but the fun still recurs.
Taking a cue from a previous support thread, I uncommented line 137 in the plugin’s source and the query being run is this …
SELECT DISTINCT p.* FROM wp_posts AS p WHERE ( p.menu_order < 0 OR p.post_title < 'Bending WP Biographia To Your Will; A Configuration Guide' AND p.menu_order = 0 ) AND p.post_type = 'page' AND p.post_status = 'publish' ORDER BY p.menu_order DESC, p.post_title DESC LIMIT 1 SELECT DISTINCT p.* FROM wp_posts AS p WHERE ( p.menu_order > 0 OR p.post_title > 'Bending WP Biographia To Your Will; A Configuration Guide' AND p.menu_order = 0 ) AND p.post_type = 'page' AND p.post_status = 'publish' ORDER BY p.menu_order ASC, p.post_title ASC LIMIT 1
You can see the way in which I’m using Next/Previous Page Link Plus in the page template’s source over on GitHub – https://github.com/vicchi/twentyten-vicchi/blob/master/page-documentation.php – but the TL;DR version is this …
if (function_exists ('previous_page_link_plus') && function_exists ('next_page_link_plus')) { $prev_format = '←%link'; $next_format = '%link→'; $args = array ('format' => $prev_format, 'loop' => true, 'order_by' => 'menu_order', 'return' => 'output'); $content = array (); $content[] = '<div id="page-links">'; $content[] = '<span class="prev-page-link">'; $content[] = previous_page_link_plus ($args); $content[] = '</span>'; $content[] = '<br />'; $args['format'] = $next_format; $content[] = '<span class="next-page-link">'; $content[] = next_page_link_plus ($args); $content[] = '</span>'; $content[] = '</div>'; echo implode (PHP_EOL, $content); }
As a side note, I’m also using the Exclude Pages From Navigation plugin to keep the navigation menu my theme generates from getting out of control. My first thought was that there may be some unforeseen side effect of suppressing certain pages from the navigation menu but the problem still recurs regardless of whether this plugin is active or not.
Any thoughts on what I’m doing wrong?
-Gary
https://www.ads-software.com/extend/plugins/ambrosite-nextprevious-page-link-plus/
- The topic ‘Ordering By Menu Order Seems To Be Ignored’ is closed to new replies.