function eventorganiser_set_template($template)
{
    //Is this necessary?
    if (is_admin()) {
        return $template;
    }
    //Has EO template handling been turned off?
    $eo_settings = get_option('eventorganiser_options');
    if (!$eo_settings['templates']) {
        return $template;
    }
    //WordPress couldn't find an 'event' template. Use plug-in instead:
    if (is_post_type_archive('event') && !eventorganiser_is_event_template($template, 'archive')) {
        $template = EVENT_ORGANISER_DIR . 'templates/archive-event.php';
    }
    if (is_singular('event') && !eventorganiser_is_event_template($template, 'event')) {
        $template = EVENT_ORGANISER_DIR . 'templates/single-event.php';
    }
    if ((is_tax('event-venue') || eo_is_venue()) && !eventorganiser_is_event_template($template, 'event-venue')) {
        $template = EVENT_ORGANISER_DIR . 'templates/taxonomy-event-venue.php';
    }
    if (is_tax('event-category') && !eventorganiser_is_event_template($template, 'event-category')) {
        $template = EVENT_ORGANISER_DIR . 'templates/taxonomy-event-category.php';
    }
    if (is_tax('event-tag') && isset($eo_settings['eventtag']) && $eo_settings['eventtag'] == 1 && !eventorganiser_is_event_template($template, 'event-tag')) {
        $template = EVENT_ORGANISER_DIR . 'templates/taxonomy-event-tag.php';
    }
    return $template;
}
 function handle_venuemap_shortcode($atts)
 {
     global $post;
     self::$add_script = true;
     //If venue is not set get from the venue being quiered or the post being viewed
     if (empty($atts['venue'])) {
         if (eo_is_venue()) {
             $atts['venue'] = esc_attr(get_query_var('term'));
         } else {
             $atts['venue'] = eo_get_venue_slug(get_the_ID());
         }
     }
     $venue_id = eo_get_venue_id_by_slugorid($atts['venue']);
     return self::get_venue_map($venue_id, $atts);
 }
Пример #3
0
function _eventorganiser_add_venue_admin_bar_edit_menu()
{
    global $wp_admin_bar;
    if (is_admin()) {
        $current_screen = get_current_screen();
        if ('event_page_venues' == $current_screen->base && isset($_GET['action']) && 'edit' == $_GET['action'] && ($tax = get_taxonomy('event-venue')) && $tax->public) {
            $wp_admin_bar->add_menu(array('id' => 'view', 'title' => $tax->labels->view_item, 'href' => eo_get_venue_link($_GET['event-venue'])));
        }
    } else {
        $current_object = get_queried_object();
        if (!eo_is_venue()) {
            return;
        }
        if (($tax = get_taxonomy($current_object->taxonomy)) && current_user_can($tax->cap->edit_terms)) {
            $wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link($current_object->term_id, $current_object->taxonomy)));
        }
    }
}
/**
 * Checks to see if appropriate templates are present in active template directory.
 * Otherwises uses templates present in plugin's template directory.
 * Hooked onto template_include'
 *
 * @ignore
 * @since 1.0.0
 * @param string $template Absolute path to template
 * @return string Absolute path to template
 */
function eventorganiser_set_template($template)
{
    //Has EO template handling been turned off?
    if (!eventorganiser_get_option('templates') || get_theme_support('event-organiser')) {
        return $template;
    }
    //If WordPress couldn't find an 'event' template use plug-in instead:
    if (is_post_type_archive('event') && !eventorganiser_is_event_template($template, 'archive')) {
        $template = EVENT_ORGANISER_DIR . 'templates/archive-event.php';
    }
    if ((is_tax('event-venue') || eo_is_venue()) && !eventorganiser_is_event_template($template, 'event-venue')) {
        $template = EVENT_ORGANISER_DIR . 'templates/taxonomy-event-venue.php';
    }
    if (is_tax('event-category') && !eventorganiser_is_event_template($template, 'event-category')) {
        $template = EVENT_ORGANISER_DIR . 'templates/taxonomy-event-category.php';
    }
    if (is_tax('event-tag') && eventorganiser_get_option('eventtag') && !eventorganiser_is_event_template($template, 'event-tag')) {
        $template = EVENT_ORGANISER_DIR . 'templates/taxonomy-event-tag.php';
    }
    /*
     * In view of theme compatibility, if an event template isn't found
     * rather than using our own single-event.php, we use ordinary single.php and
     * add content in via the_content
     */
    if (is_singular('event') && !eventorganiser_is_event_template($template, 'event')) {
        //Viewing a single event
        //Hide next/previous post link
        add_filter("next_post_link", '__return_false');
        add_filter("previous_post_link", '__return_false');
        //Prepend our event details
        add_filter('the_content', '_eventorganiser_single_event_content');
    }
    return $template;
}
 static function handle_venuemap_shortcode($atts)
 {
     global $post;
     if (!empty($atts['event_venue'])) {
         $atts['venue'] = $atts['event_venue'];
     }
     //If venue is not set get from the venue being quiered or the post being viewed
     if (empty($atts['venue'])) {
         if (eo_is_venue()) {
             $atts['venue'] = esc_attr(get_query_var('term'));
         } else {
             $atts['venue'] = eo_get_venue_slug(get_the_ID());
         }
     }
     $venue_slugs = explode(',', $atts['venue']);
     $args = shortcode_atts(array('zoom' => 15, 'scrollwheel' => 'true', 'zoomcontrol' => 'true', 'rotatecontrol' => 'true', 'pancontrol' => 'true', 'overviewmapcontrol' => 'true', 'streetviewcontrol' => 'true', 'maptypecontrol' => 'true', 'draggable' => 'true', 'maptypeid' => 'ROADMAP', 'width' => '100%', 'height' => '200px', 'class' => '', 'tooltip' => 'false'), $atts);
     //Cast options as boolean:
     $bool_options = array('tooltip', 'scrollwheel', 'zoomcontrol', 'rotatecontrol', 'pancontrol', 'overviewmapcontrol', 'streetviewcontrol', 'draggable', 'maptypecontrol');
     foreach ($bool_options as $option) {
         $args[$option] = $args[$option] == 'false' ? false : true;
     }
     return eo_get_venue_map($venue_slugs, $args);
 }