post_type == EM_POST_TYPE_LOCATION ){ $template = locate_template(array('page.php','index.php'),false); } return $template; } function the_content( $content ){ global $post; if( $post->post_type == EM_POST_TYPE_LOCATION ){ if( is_archive() || is_search() ){ if( get_option('dbem_cp_locations_archive_formats') ){ $EM_Location = em_get_location($post); $content = $EM_Location->output(get_option('dbem_location_list_item_format')); } }else{ if( get_option('dbem_cp_locations_formats') && !post_password_required() ){ $EM_Location = em_get_location($post); $content = $EM_Location->output_single(); } } } return $content; } 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( empty($wp_query->query_vars['location']) ) { 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_orderby','ASC'); } } } } } EM_Location_Post::init();