/** * Enable random order of projects displayed in the widget */ add_action('pre_get_posts', 'sydney_child_change_projects_order', 9999); function sydney_child_change_projects_order($query) { if( !is_admin() && !is_search() && !is_archive() && is_main_query() && $query->query_vars['post_type'] =='projects' ) { $query->set('orderby', 'rand'); // Random order } }
This snippet initially posted at Sydney support forum.