Пример #1
0
 function template_redirect()
 {
     if (get_query_var($this->query_var)) {
         // Set embed map
         if (isset($_GET['map_id'])) {
             jeo_set_map(get_post($_GET['map_id']));
         } else {
             $maps = get_posts(array('post_type' => 'map', 'posts_per_page' => 1));
             if ($maps) {
                 jeo_set_map(array_shift($maps));
             } else {
                 exit;
             }
         }
         // Set tax
         if (isset($_GET['tax'])) {
             global $wp_query;
             $wp_query->set('tax_query', array(array('taxonomy' => $_GET['tax'], 'field' => 'slug', 'terms' => $_GET['term'])));
         }
         add_filter('show_admin_bar', '__return_false');
         do_action('jeo_before_embed');
         $this->template();
         do_action('jeo_after_embed');
         exit;
     }
 }
Пример #2
0
 function the_post_map($p = false)
 {
     global $post;
     $p = $p ? $p : $post;
     $map = jeo_the_map();
     if (is_single() && $this->has_location($p->ID) && !is_singular(array('map', 'map-group'))) {
         $post_maps = get_post_meta($p->ID, 'maps');
         if (!$map) {
             if ($post_maps) {
                 $map = get_post(array_shift($post_maps));
             } else {
                 $map = jeo_map_featured();
             }
             jeo_set_map($map);
         }
     }
     return jeo_the_map();
 }