/** * Set the order for portfolio type taxonomy archives * * @param obj $query the query object * @return void */ function zilla_set_archive_order($query) { if ($query->is_tax('portfolio-type') && $query->is_main_query()) { $query->set('orderby', 'menu_order'); $query->set('order', 'ASC'); } }
/** * Hide inactive events from the 'all' events list. * * @since 1.0 * @param obj $query The WP_Query. * @return void */ function mdjm_hide_inactive_events($query) { if (!is_admin() || !$query->is_main_query() || 'mdjm-event' != $query->get('post_type')) { return; } $active_statuses = mdjm_active_event_statuses(); if (isset($_GET['post_status']) && in_array($_GET['post_status'], $active_statuses)) { return; } if (!mdjm_get_option('show_active_only', false)) { return; } $active_ids = mdjm_get_events(array('post_status' => $active_statuses, 'fields' => 'ids')); if ($active_ids) { $query->set('post__in', $active_ids); } }