ocation = em_get_location($post); if( !empty($_REQUEST['preview']) ){ //we don't do extra checks here because WP will have already done the work for us here... $EM_Location->post_content = $post->post_content; $EM_Location->post_content_filtered = $post->post_content_filtered; }else{ $EM_Location->post_content = $content; } ob_start(); $args = array(); if( em_is_event_page() ){ $args['id'] = 7; } em_locate_template('templates/location-single.php',true, array('args' => $args)); $content = ob_get_clean(); } } } return $content; } public static function parse_query(){ global $wp_query; if( !empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == EM_POST_TYPE_LOCATION ){ if( is_admin() ){ $wp_query->query_vars['orderby'] = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby']:'title'; $wp_query->query_vars['order'] = (!empty($_REQUEST['order'])) ? $_REQUEST['order']:'ASC'; }else{ if( get_option('dbem_locations_default_archive_orderby') == 'title'){ $wp_query->query_vars['orderby'] = 'title'; }else{ $wp_query->query_vars['orderby'] = 'meta_value_num'; $wp_query->query_vars['meta_key'] = get_option('dbem_locations_default_archive_orderby','_location_country'); } $wp_query->query_vars['order'] = get_option('dbem_locations_default_archive_order','ASC'); } } } } EM_Location_Post::init();