Sort No Longer Working
-
We’d previous had an issue with the Post Types Order plugin altering the order of our Event Calendar posts. It was recommended to try the code from this page:
https://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/
It did the trick for awhile. Our Featured Slider posts were able to be reordered by drag and drop and our Event Calendar posts were in their proper order. However, now there’s a conflict. If I use the “ignore” code to exclude the Event Calendar posts (the post type is tribe_events), the drag and drop sorting no longer works for the Featured posts. If the code is removed, the drag and drop works fine but the Event Calendar events show out of order.
This is the code I used:
add_filter(‘pto/posts_orderby’, ‘theme_pto_posts_orderby’, 10, 2);
function theme_pto_posts_orderby($orderBy, $query)
{
if( (! is_array($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] = ‘tribe_events’) ||
(is_array($query->query_vars) && in_array(‘tribe_events’, $query->query_vars)))
return FALSE;return $orderBy;
}I placed it in the functions.php file.
Please note, I’m conversant with CSS and HTML but not so much with PHP.
Thanks in advance.
- The topic ‘Sort No Longer Working’ is closed to new replies.