WPPizza – A Restaurant Plugin for WordPress › Support › General Support › Items sorting problem
- AuthorPosts
- 16 July, 2014 at 1:25 pm #4416
Hi Olly,
I have Items as follows
29 – Pizza abc
30 – Pizza bcd
31 – Some item
32 – asdf
33 – whatever
and so on
The problem is that they are not displayed in a sequence as above. 31 is after 29 and so on. Can you please help?
Thanks16 July, 2014 at 2:11 pm #4417I have solved the issue by adding this code into my function.php.
/*************************************************************************
Sorting: source= http://wordpress.org/support/topic/sort-posts-alphabetically-1
***************************************************************************/
function wpsf_orderby( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
// do conditional checks here and return on false.?{
remove_action( ‘pre_get_posts’, __FUNCTION__ );
add_filter( ‘posts_orderby’, function() { return ‘ post_title ASC’; } );
}
}add_action( ‘pre_get_posts’, ‘wpsf_orderby’ );
16 July, 2014 at 2:49 pm #4418you could do that i guess, or of course just use the “order” field that every menu item has (available in quick edit too, not just when “normally” editing an item
just saying…
- AuthorPosts
- The topic ‘Items sorting problem’ is closed to new replies.