I’m getting this error:
Notice: Undefined index: post_type in /…/wp-content/themes/x-child/functions.php on line 47
The code that was once working that Themeco suggested is here:
/randomize portfolio images/
function cmk_custom_order( $wp_query ) {
/* Get the post type from the query*/
$post_type = $wp_query->query[‘post_type’];
/If Post type is Portfolio/
if ( $post_type == ‘x-portfolio’) {
/* Set Order to Random*/
$wp_query->set(‘orderby’, ‘rand’);
/* un-comment if not using random order /
//$wp_query->set(‘order’, ‘DESC’);
}
}
/ Change Order settings before displaying the Postype*/
add_filter(‘pre_get_posts’, ‘cmk_custom_order’);
The page it’s used on is here:
Please help!