コード例 #1
0
/**
 * Theme basic config.
 *
 * @see https://gist.github.com/jo-snips/2415009
 */
function dt_the_events_calendar_template_config()
{
    // detect calendar pages
    if (tribe_is_month() && !is_tax() || tribe_is_month() && is_tax() || (tribe_is_past() || tribe_is_upcoming() && !is_tax()) || (tribe_is_past() || tribe_is_upcoming() && is_tax()) || tribe_is_day() && !is_tax() || tribe_is_day() && is_tax() || tribe_is_event() && is_single() || tribe_is_venue() || function_exists('tribe_is_week') && tribe_is_week() || function_exists('tribe_is_photo') && tribe_is_photo() || function_exists('tribe_is_map') && tribe_is_map() || get_post_type() == 'tribe_organizer' && is_single()) {
        // remove theme title controller
        remove_action('presscore_before_main_container', 'presscore_page_title_controller', 16);
    }
}
コード例 #2
0
 /**
  * Venue ID
  *
  * Returns the event Venue ID.
  *
  * @param int $postId can supply either event id or venue id, if none specified, current post is used
  *
  * @return int Venue ID
  */
 function tribe_get_venue_id($postId = null)
 {
     $postId = Tribe__Events__Main::postIdHelper($postId);
     if (tribe_is_venue($postId)) {
         return $postId;
     } else {
         return apply_filters('tribe_get_venue_id', tribe_get_event_meta($postId, '_EventVenueID', true));
     }
 }
コード例 #3
0
ファイル: venue.php プロジェクト: mpaskew/isc-dev
 /**
  * Venue ID
  *
  * Returns the event Venue ID.
  *
  * @param int $postId can supply either event id or venue id, if none specified, current post is used
  * @return int Venue ID
  * @since 2.0
  */
 function tribe_get_venue_id($postId = null)
 {
     $postId = TribeEvents::postIdHelper($postId);
     if (tribe_is_venue($postId)) {
         return $postId;
     } else {
         return tribe_get_event_meta($postId, '_EventVenueID', true);
     }
 }
コード例 #4
0
 /**
  * Update the location information associated with the venue map to use coordinates
  * in place of a street address, if possible.
  *
  * @param $map_index
  * @param $venue_id
  */
 public function use_venue_coords($map_index, $venue_id)
 {
     // If we don't have a venue to work with, bail
     if (!tribe_is_venue($venue_id)) {
         return;
     }
     // Try to load the coordinates - it's possible none will be set
     $this->lat = get_post_meta($venue_id, Tribe__Events__Pro__Geo_Loc::LAT, true);
     $this->lng = get_post_meta($venue_id, Tribe__Events__Pro__Geo_Loc::LNG, true);
     // If we have valid coordinates let's put them to work
     if (!$this->are_coords_valid()) {
         return;
     }
     $this->setup_coords($map_index);
 }
コード例 #5
0
ファイル: google-map.php プロジェクト: mpaskew/isc-dev
 /**
  * Google Map Embed
  *
  * Returns an embedded google maps for an event
  *
  * @param string $postId 
  * @param int $width 
  * @param int $height
  * @param bool $force_load If true, then load the map even if an address is not provided.
  * @return string An iframe pulling http://maps.google.com/ for this event
  * @since 2.0
  */
 function tribe_get_embedded_map($postId = null, $width = '', $height = '', $force_load = false)
 {
     $postId = TribeEvents::postIdHelper($postId);
     if (!tribe_is_venue($postId) && !tribe_is_event($postId)) {
         return false;
     }
     $postId = tribe_is_venue($postId) ? $postId : tribe_get_venue_id($postId);
     $locationMetaSuffixes = array('address', 'city', 'state', 'province', 'zip', 'country');
     $toUrlEncode = "";
     foreach ($locationMetaSuffixes as $val) {
         $metaVal = call_user_func('tribe_get_' . $val);
         if ($metaVal) {
             $toUrlEncode .= $metaVal . " ";
         }
     }
     if ($toUrlEncode) {
         $address = $toUrlEncode;
     } else {
         $address = null;
     }
     if (!$height) {
         $height = tribe_get_option('embedGoogleMapsHeight', '350');
     }
     if (!$width) {
         $width = tribe_get_option('embedGoogleMapsWidth', '100%');
     }
     if ($address || $force_load) {
         ob_start();
         include TribeEvents::instance()->pluginPath . 'admin-views/event-map.php';
         $google_map = ob_get_contents();
         ob_get_clean();
         return $google_map;
     } else {
         return '';
     }
 }
 public function body_class($c)
 {
     if (get_query_var('post_type') == self::POSTTYPE) {
         if (!is_single()) {
             if (tribe_is_upcoming() || tribe_is_past()) {
                 $c[] = 'events-list';
             } else {
                 $c[] = 'events-gridview';
             }
         }
         if (is_tax(self::TAXONOMY)) {
             $c[] = 'events-category';
             $category = get_term_by('name', single_cat_title('', false), self::TAXONOMY);
             $c[] = 'events-category-' . $category->slug;
         }
         if (!is_single() || tribe_is_showing_all()) {
             $c[] = 'events-archive';
         } else {
             $c[] = 'events-single';
         }
     }
     global $post;
     if (is_object($post) && tribe_is_venue($post->ID)) {
         $c[] = 'events-venue';
     }
     return $c;
 }
コード例 #7
0
 function mfn_sidebar_classes($has_both = false)
 {
     $classes = false;
     $both = false;
     if (mfn_ID()) {
         if (get_post_type() == 'page' && mfn_opts_get('single-page-layout')) {
             // Theme Options | Single - Page
             $layout = mfn_opts_get('single-page-layout');
         } elseif (get_post_type() == 'post' && is_single() && mfn_opts_get('single-layout')) {
             // Theme Options | Single - Post
             $layout = mfn_opts_get('single-layout');
         } elseif (get_post_type() == 'portfolio' && is_single() && mfn_opts_get('single-portfolio-layout')) {
             // Theme Options | Single - Portfolio
             $layout = mfn_opts_get('single-portfolio-layout');
         } else {
             // Post Meta
             $layout = get_post_meta(mfn_ID(), 'mfn-post-layout', true);
         }
         switch ($layout) {
             case 'left-sidebar':
                 $classes = ' with_aside aside_left';
                 break;
             case 'right-sidebar':
                 $classes = ' with_aside aside_right';
                 break;
             case 'both-sidebars':
                 $classes = ' with_aside aside_both';
                 $both = true;
                 break;
         }
         // demo
         if ($_GET && key_exists('mfn-s', $_GET)) {
             if ($_GET['mfn-s']) {
                 $classes = ' with_aside aside_right';
             } else {
                 $classes = false;
             }
         }
     }
     // WooCommerce
     if (function_exists('is_woocommerce')) {
         if (is_woocommerce()) {
             if ($layout == 'both-sidebars') {
                 // Only one sidebar for shop
                 $classes = ' with_aside aside_right';
             } elseif (!$layout) {
                 // BeTheme version < 6.4 | DO NOT DELETE
                 if (is_active_sidebar('shop')) {
                     $classes = ' with_aside aside_right';
                 }
             }
         }
         if (is_product() && mfn_opts_get('shop-sidebar') == 'shop') {
             $classes = false;
         }
     }
     // bbPress
     if (function_exists('is_bbpress') && is_bbpress() && is_active_sidebar('forum')) {
         $classes = ' with_aside aside_right';
     }
     // BuddyPress
     if (function_exists('is_buddypress') && is_buddypress() && is_active_sidebar('buddy')) {
         $classes = ' with_aside aside_right';
     }
     // Events Calendar
     if (function_exists('tribe_is_month') && is_active_sidebar('events')) {
         if (tribe_is_month() || tribe_is_day() || tribe_is_event() || tribe_is_event_query() || tribe_is_venue()) {
             $classes = ' with_aside aside_right';
         }
     }
     // check if has both sidebars
     if ($has_both) {
         return $both;
     }
     // Page Template: Blank Page, Under Construction
     if (is_page_template('template-blank.php') || is_page_template('under-construction.php')) {
         $classes = false;
     }
     return $classes;
 }
コード例 #8
0
 function mfn_breadcrumbs($class = false)
 {
     global $post;
     $translate['home'] = mfn_opts_get('translate') ? mfn_opts_get('translate-home', 'Home') : __('Home', 'betheme');
     $homeLink = home_url();
     $separator = ' <span><i class="icon-right-open"></i></span>';
     // Plugin | bbPress -----------------------------------
     if (function_exists('is_bbpress') && is_bbpress()) {
         bbp_breadcrumb(array('before' => '<ul class="breadcrumbs">', 'after' => '</ul>', 'sep' => '<i class="icon-right-open"></i>', 'crumb_before' => '<li>', 'crumb_after' => '</li>', 'home_text' => $translate['home']));
         return true;
     }
     // end: bbPress -------------------------------------
     // Default breadcrumbs --------------------------------
     $breadcrumbs = array();
     // Home prefix --------------------------------
     $breadcrumbs[] = '<a href="' . $homeLink . '">' . $translate['home'] . '</a>';
     // Blog -------------------------------------------
     if (get_post_type() == 'post') {
         $blogID = false;
         if (get_option('page_for_posts')) {
             $blogID = get_option('page_for_posts');
             // Setings / Reading
         } elseif (mfn_opts_get('blog-page')) {
             $blogID = mfn_opts_get('blog-page');
             // Theme Options / Getting Started / Blog
         }
         if ($blogID) {
             $breadcrumbs[] = '<a href="' . get_permalink($blogID) . '">' . get_the_title($blogID) . '</a>';
         }
     }
     // Plugin | Events Calendar -------------------------------------------
     if (function_exists('tribe_is_month') && (tribe_is_event_query() || tribe_is_month() || tribe_is_event() || tribe_is_day() || tribe_is_venue())) {
         if (function_exists('tribe_get_events_link')) {
             $breadcrumbs[] = '<a href="' . tribe_get_events_link() . '">' . tribe_get_events_title() . '</a>';
         }
     } elseif (is_front_page() || is_home()) {
         // do nothing
         // Blog | Tag -------------------------------------
     } elseif (is_tag()) {
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . single_tag_title('', false) . '</a>';
         // Blog | Category --------------------------------
     } elseif (is_category()) {
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . single_cat_title('', false) . '</a>';
         // Blog | Author ----------------------------------
     } elseif (is_author()) {
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_author() . '</a>';
         // Blog | Day -------------------------------------
     } elseif (is_day()) {
         $breadcrumbs[] = '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>';
         $breadcrumbs[] = '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>';
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_time('d') . '</a>';
         // Blog | Month -----------------------------------
     } elseif (is_month()) {
         $breadcrumbs[] = '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>';
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_time('F') . '</a>';
         // Blog | Year ------------------------------------
     } elseif (is_year()) {
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_time('Y') . '</a>';
         // Single -----------------------------------------
     } elseif (is_single() && !is_attachment()) {
         // Custom Post Type -----------------
         if (get_post_type() != 'post') {
             $post_type = get_post_type_object(get_post_type());
             $slug = $post_type->rewrite;
             $portfolio_page_id = mfn_wpml_ID(mfn_opts_get('portfolio-page'));
             // Portfolio Page ------------
             if ($slug['slug'] == mfn_opts_get('portfolio-slug', 'portfolio-item') && $portfolio_page_id) {
                 $breadcrumbs[] = '<a href="' . get_page_link($portfolio_page_id) . '">' . get_the_title($portfolio_page_id) . '</a>';
             }
             // Category ----------
             if ($portfolio_page_id) {
                 $terms = get_the_terms(get_the_ID(), 'portfolio-types');
                 if (!empty($terms) && !is_wp_error($terms)) {
                     $term = $terms[0];
                     $breadcrumbs[] = '<a href="' . get_term_link($term) . '">' . $term->name . '</a>';
                 }
             }
             // Single Item --------
             $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title() . '</a>';
             // Blog | Single --------------------
         } else {
             $cat = get_the_category();
             if (!empty($cat)) {
                 $breadcrumbs[] = get_category_parents($cat[0], true, $separator);
             }
             $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title() . '</a>';
         }
         // Taxonomy ---------------------------------------
     } elseif (!is_page() && get_post_taxonomies()) {
         // Portfolio ------------------------
         $post_type = get_post_type_object(get_post_type());
         if ($post_type->name == 'portfolio' && ($portfolio_page_id = mfn_wpml_ID(mfn_opts_get('portfolio-page')))) {
             $breadcrumbs[] = '<a href="' . get_page_link($portfolio_page_id) . '">' . get_the_title($portfolio_page_id) . '</a>';
         }
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . single_cat_title('', false) . '</a>';
         // Page with parent -------------------------------
     } elseif (is_page() && $post->post_parent) {
         $parent_id = $post->post_parent;
         $parents = array();
         while ($parent_id) {
             $page = get_page($parent_id);
             $parents[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
             $parent_id = $page->post_parent;
         }
         $parents = array_reverse($parents);
         $breadcrumbs = array_merge_recursive($breadcrumbs, $parents);
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title(mfn_ID()) . '</a>';
         // Default ----------------------------------------
     } else {
         $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title(mfn_ID()) . '</a>';
     }
     // PRINT ------------------------------------------------------------------
     echo '<ul class="breadcrumbs ' . $class . '">';
     $count = count($breadcrumbs);
     $i = 1;
     foreach ($breadcrumbs as $bk => $bc) {
         if (strpos($bc, $separator)) {
             // Category parents fix
             echo '<li>' . $bc . '</li>';
         } else {
             if ($i == $count) {
                 $separator = '';
             }
             echo '<li>' . $bc . $separator . '</li>';
         }
         $i++;
     }
     echo '</ul>';
 }
コード例 #9
0
 protected function get_ids($post_id)
 {
     $post_id = $post_id = Tribe__Events__Main::postIdHelper($post_id);
     $this->event_id = tribe_is_event($post_id) ? $post_id : 0;
     $this->venue_id = tribe_is_venue($post_id) ? $post_id : tribe_get_venue_id($post_id);
 }
コード例 #10
0
ファイル: theme-head.php プロジェクト: plowzzer/betheme_derma
function mfn_sidebar_classes()
{
    $classes = false;
    if (mfn_ID()) {
        if (get_post_type() == 'page' && mfn_opts_get('single-page-layout')) {
            // Theme Options | Page
            $layout = mfn_opts_get('single-page-layout');
        } elseif (get_post_type() == 'post' && is_single() && mfn_opts_get('single-layout')) {
            // Theme Options | Single Post
            $layout = mfn_opts_get('single-layout');
        } else {
            // Post Meta
            $layout = get_post_meta(mfn_ID(), 'mfn-post-layout', true);
        }
        switch ($layout) {
            case 'left-sidebar':
                $classes = ' with_aside aside_left';
                break;
            case 'right-sidebar':
                $classes = ' with_aside aside_right';
                break;
        }
        // demo
        if ($_GET && key_exists('mfn-s', $_GET)) {
            if ($_GET['mfn-s']) {
                $classes = ' with_aside aside_right';
            } else {
                $classes = false;
            }
        }
    }
    // bbPress
    if (function_exists('is_bbpress') && is_bbpress() && is_active_sidebar('forum')) {
        $classes = ' with_aside aside_right';
    }
    // Events Calendar
    if (function_exists('tribe_is_month') && is_active_sidebar('events')) {
        if (tribe_is_month() || tribe_is_day() || tribe_is_event() || tribe_is_event_query() || tribe_is_venue()) {
            $classes = ' with_aside aside_right';
        }
    }
    return $classes;
}
コード例 #11
0
$venue_id = get_the_ID();
$full_region = tribe_get_full_region($venue_id);
?>

<span class="address-details">

	<?php 
// This location's street address.
if (tribe_get_address($venue_id)) {
    ?>
	<span class="street-address"><?php 
    echo tribe_get_address($venue_id);
    ?>
</span>
		<?php 
    if (!tribe_is_venue()) {
        ?>
		<?php 
    }
    ?>
	<?php 
}
?>

	<?php 
// This locations's city.
if (tribe_get_city($venue_id)) {
    if (tribe_get_address($venue_id)) {
        ?>
		<?php 
    }
コード例 #12
0
 /**
  * Update the location information associated with the venue map to use coordinates
  * in place of a street address, if possible.
  *
  * @param $map_index
  * @param $venue_id
  */
 public function use_coords($map_index, $venue_id)
 {
     // Sanity checks: we need a venue to work with and the correct version of TEC
     if (!tribe_is_venue($venue_id)) {
         return;
     }
     if (!class_exists('Tribe__Events__Embedded_Maps')) {
         return;
     }
     // Try to load the coordinates - it's possible none will be set
     $lat = get_post_meta($venue_id, $this->lat_key, true);
     $lng = get_post_meta($venue_id, $this->lng_key, true);
     if (!$this->valid_coords($lat, $lng)) {
         return;
     }
     // If we have valid coordinates let's put them to work
     $mapping = Tribe__Events__Embedded_Maps::instance();
     $venue_data = $mapping->get_map_data($map_index);
     $venue_data['coords'] = array($lat, $lng);
     $mapping->update_map_data($map_index, $venue_data);
 }
コード例 #13
0
/**
 * Test to see if this is the Venue edit screen
 *
 * @param int|null $venue_id (optional)
 * @return bool
 * @author Peter Chester
 * @since 3.1
 */
function tribe_community_events_is_venue_edit_screen($venue_id = null)
{
    $venue_id = TribeEvents::postIdHelper($venue_id);
    return tribe_is_venue($venue_id);
}