A dream come true for WordPress (+question)
-
Truly a dream find in plugin repository. I have been searching for months for a solution that would finally list all my pages in exact order as they appear in my admin and in my navigation menu. The fact that the menu is synced dynamically is a pure miracle for me. I was looking for a vice-versa solution originally, but it does not matter.
However, I do have an issue.
The plugin should display in frontend the order I drag&drop in backend. I use a category archive page for frontend list.
I just tested and this plugin assigns integers into Pages’ ‘order’ field, whenever drag&drop is being done. However on front end the list defaults to date of post, in descending order!
I can only force it to display this order in frontend by mandatory fullfilling 2 additional conditions:- Have the belowmentioned hook code in functions.php (with both order ‘asc’, and orderby ‘menu_order’) enabled
- Go manually to Appearance > Menu and save the menu after each drag & drop change
It is only then that my ordering changes actually appear on frontend.
The hook code is this:
function change_category_order( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( 'order', 'asc' ); // sortira po datumu posta $query->set( 'orderby', 'menu_order' ); // sortira po broju u Edit Page } } add_action( 'pre_get_posts', 'change_category_order' );
If I exclude the hook code, the listing on frontend will fall to default, by date of post, and descending.
If I enable the hook code, but do not manually save the the Menu, the order in frontend will be garbled with no particular logic.I guess I kinda found the workaround but it is far from using the plugin how it was intended. If you can shed more light on it I will be greatly thankful.
- The topic ‘A dream come true for WordPress (+question)’ is closed to new replies.