Display Random Projects in Sydney Portfolio Widget

Add this PHP code to child theme's functions or use a functionality plugin like Code Snippets:
 * 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.

Leave a Reply

Your email address will not be published. Required fields are marked *