/**
  * Recurrence validation method.  This is checked after saving an event, but before splitting a series out into
  * multiple occurrences
  *
  * @param int   $event_id        The event object that is being saved
  * @param array $recurrence_meta Recurrence information for this event
  *
  * @return bool
  */
 public function is_valid($event_id, array $recurrence_meta)
 {
     $response = (object) array('valid' => true, 'message' => '');
     $this->event_id = $event_id;
     $this->recurrence_meta = $recurrence_meta;
     if (!tribe_is_event($event_id)) {
         $response->valid = false;
         $response->message = __('Not an event post.', 'tribe-events-calendar-pro');
         return $this->filtered_response($response);
     }
     try {
         $this->ensure_not_empty();
         if ($this->is_custom()) {
             $this->ensure_custom_type();
             $this->ensure_all_data();
             if ($this->is_monthly()) {
                 $this->ensure_monthly_day_and_number();
             } else {
                 if ($this->is_yearly()) {
                     $this->ensure_yearly_day();
                 }
             }
         }
     } catch (RuntimeException $e) {
         $response->valid = false;
         $response->message = $e->getMessage();
     }
     return $this->filtered_response($response);
 }
/**
 * 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);
    }
}
 public function user_update()
 {
     if (!tribe_is_event($this->event_id)) {
         return;
     }
     $notice = __('Recurring event data is still being generated for this event. Don’t worry, you can safely navigate away – the process will resume in a bit in the background.', 'tribe-events-pro');
     $percent = $this->sanitize_progress($this->queue->progress_percentage());
     $spinner = '<img src="' . get_admin_url(null, '/images/spinner.gif') . '">';
     $indicator = '<div> <div class="progress" title="' . sprintf(__('%d%% complete', 'tribe-events-pro'), $percent) . '"> <div class="bar"></div> </div>' . $spinner . '</div>';
     return "<p> {$notice} </p> {$indicator}";
 }
 /**
  * Returns the link to export the whole recurring  series in iCal format.
  *
  * @param int|WP_Pos|null $event_id A event post object, an event post ID or null to use the globally defined post object.
  *
  * @return string The absolute URL to export the whole recurring series in iCal format.
  */
 function tribe_get_recurrence_ical_link($event_id = null)
 {
     $event_id = Tribe__Events__Main::postIdHelper($event_id);
     if (empty($event_id) || !tribe_is_event($event_id)) {
         return '';
     }
     $event = get_post($event_id);
     $parent_id = empty($event->post_parent) ? $event_id : $event->post_parent;
     $url = get_permalink($parent_id);
     $url_vars = array('ical' => '1');
     if (tribe_is_recurring_event($parent_id)) {
         $child_events_ids = tribe_get_events(array('fields' => 'ids', 'post_parent' => $parent_id));
         $event_ids = array_merge(array($parent_id), $child_events_ids);
         $url_vars['event_ids'] = implode(',', $event_ids);
     }
     $url = add_query_arg($url_vars, $url);
     return apply_filters('tribe_get_recurrence_ical_link', $url, $event_id);
 }
Exemple #5
0
 /**
  * fetches an event's cost values
  *
  * @param int|WP_Post $event The Event post object or event ID
  *
  * @return array
  */
 public function get_event_costs($event)
 {
     $event = get_post($event);
     if (!is_object($event) || !$event instanceof WP_Post) {
         return array();
     }
     if (!tribe_is_event($event->ID)) {
         return array();
     }
     $costs = tribe_get_event_meta($event->ID, '_EventCost', false);
     $parsed_costs = array();
     foreach ($costs as $index => $value) {
         if ('' === $value) {
             continue;
         }
         $parsed_costs += $this->parse_cost_range($value);
     }
     return $parsed_costs;
 }
Exemple #6
0
 /**
  * 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 '';
     }
 }
 /**
  * Filters the_content to show the event when we are in the main loop and showing events
  *
  * @param string $content
  * @return string Filtered content
  * @since 2.1
  */
 public static function hijackContentInMainLoop($content)
 {
     // only run once!!!
     remove_filter('the_content', array(__CLASS__, 'hijackContentInMainLoop'));
     global $post;
     if (tribe_is_in_main_loop() && tribe_is_event($post->ID)) {
         ob_start();
         echo stripslashes(tribe_get_option('tribeEventsBeforeHTML'));
         include_once self::getTemplateHierarchy('in-loop');
         echo stripslashes(tribe_get_option('tribeEventsAfterHTML'));
         $content = ob_get_contents();
         ob_end_clean();
     }
     return $content;
 }
Exemple #8
0
 /**
  * Event in Category Conditional
  *
  * Returns true if the event is in the specified category slug
  *
  * @category Events
  * @param string $event_cat_slug
  * @param int    $event_id
  *
  * @return boolean
  */
 function tribe_event_in_category($event_cat_slug, $event_id = null)
 {
     if (empty($event_id)) {
         $event_id = get_the_ID();
     }
     $term = term_exists($event_cat_slug, Tribe__Events__Main::TAXONOMY);
     if (tribe_is_event($event_id) && is_object_in_term($event_id, Tribe__Events__Main::TAXONOMY, array($term['term_id']))) {
         $return = true;
     } else {
         $return = false;
     }
     return apply_filters('tribe_event_in_category', $return);
 }
 function avada_get_page_title_bar_contents($post_id, $get_secondary_content = TRUE)
 {
     if ($get_secondary_content) {
         ob_start();
         if (fusion_get_option('page_title_bar_bs', 'page_title_breadcrumbs_search_bar', $post_id) != 'none') {
             if ('Breadcrumbs' == Avada()->settings->get('page_title_bar_bs') && in_array(get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true), array('breadcrumbs', 'default', '')) || 'breadcrumbs' == get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true)) {
                 fusion_breadcrumbs();
             } elseif ('Search Box' == Avada()->settings->get('page_title_bar_bs') && in_array(get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true), array('searchbar', 'default', '')) || 'searchbar' == get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true)) {
                 get_search_form();
             }
         }
         $secondary_content = ob_get_contents();
         ob_get_clean();
     } else {
         $secondary_content = '';
     }
     $title = '';
     $subtitle = '';
     if ('' != get_post_meta($post_id, 'pyre_page_title_custom_text', true)) {
         $title = get_post_meta($post_id, 'pyre_page_title_custom_text', true);
     }
     if ('' != get_post_meta($post_id, 'pyre_page_title_custom_subheader', true)) {
         $subtitle = get_post_meta($post_id, 'pyre_page_title_custom_subheader', true);
     }
     if ('' == get_post_meta($post_id, 'pyre_page_title_text', true) || 'default' == get_post_meta($post_id, 'pyre_page_title_text', true)) {
         $page_title_text = Avada()->settings->get('page_title_bar_text');
     } else {
         $page_title_text = get_post_meta($post_id, 'pyre_page_title_text', true);
     }
     if (!$title) {
         $title = get_the_title();
         if (is_home()) {
             $title = Avada()->settings->get('blog_title');
         }
         if (is_search()) {
             $title = sprintf(__('Search results for: %s', 'Avada'), get_search_query());
         }
         if (is_404()) {
             $title = __('Error 404 Page', 'Avada');
         }
         if (class_exists('Tribe__Events__Main') && (tribe_is_event() && !is_single() && !is_home() || is_events_archive() || is_events_archive() && is_404())) {
             $title = tribe_get_events_title();
         }
         if (is_archive() && !is_bbpress() && !is_search()) {
             if (is_day()) {
                 $title = sprintf(__('Daily Archives: %s', 'Avada'), '<span>' . get_the_date() . '</span>');
             } else {
                 if (is_month()) {
                     $title = sprintf(__('Monthly Archives: %s', 'Avada'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'Avada')) . '</span>');
                 } elseif (is_year()) {
                     $title = sprintf(__('Yearly Archives: %s', 'Avada'), '<span> ' . get_the_date(_x('Y', 'yearly archives date format', 'Avada')) . '</span>');
                 } elseif (is_author()) {
                     $curauth = get_user_by('id', get_query_var('author'));
                     $title = $curauth->nickname;
                 } elseif (is_post_type_archive()) {
                     $title = post_type_archive_title('', false);
                     $sermon_settings = get_option('wpfc_options');
                     if (is_array($sermon_settings)) {
                         $title = $sermon_settings['archive_title'];
                     }
                 } else {
                     $title = single_cat_title('', false);
                 }
             }
         }
         if (class_exists('WooCommerce') && is_woocommerce() && (is_product() || is_shop()) && !is_search()) {
             if (!is_product()) {
                 $title = woocommerce_page_title(false);
             }
         }
     }
     if (!$subtitle && is_home()) {
         $subtitle = Avada()->settings->get('blog_subtitle');
     }
     if (!is_archive() && !is_search() && !(is_home() && !is_front_page())) {
         if ('no' == $page_title_text && ('yes' == get_post_meta($post_id, 'pyre_page_title', true) || 'yes_without_bar' == get_post_meta($post_id, 'pyre_page_title', true) || 'hide' != Avada()->settings->get('page_title_bar') && 'no' != get_post_meta($post_id, 'pyre_page_title', true))) {
             $title = '';
             $subtitle = '';
         }
     } else {
         if ('hide' != Avada()->settings->get('page_title_bar') && 'no' == $page_title_text) {
             $title = '';
             $subtitle = '';
         }
     }
     return array($title, $subtitle, $secondary_content);
 }
 /**
  * Returns json for javascript templating functions throughout the plugin.
  *
  * @category Events
  *
  * @param $event
  * @param $additional
  *
  * @return string
  */
 function tribe_events_template_data($event = null, array $additional = null)
 {
     // Base JSON variable
     $json = array('i18n' => array());
     if (!is_null($event)) {
         $event = get_post($event);
         // Check if we are dealing with an Event
         if (is_object($event) && $event instanceof WP_Post && tribe_is_event($event->ID)) {
             $has_image = false;
             $image_src = '';
             $image_tool_src = '';
             $date_display = '';
             //Disable recurring event info in tooltip
             if (class_exists('Tribe__Events__Pro__Main')) {
                 $ecp = Tribe__Events__Pro__Main::instance();
                 $ecp->disable_recurring_info_tooltip();
                 $date_display = strip_tags(tribe_events_event_schedule_details($event));
                 // Re-enable recurring event info
                 $ecp->enable_recurring_info_tooltip();
             } else {
                 $date_display = strip_tags(tribe_events_event_schedule_details($event));
             }
             if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) {
                 $has_image = true;
                 $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium');
                 $image_src = $image_arr[0];
             }
             if ($has_image) {
                 $image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75));
                 $image_tool_src = $image_tool_arr[0];
             }
             if (has_excerpt($event->ID)) {
                 $excerpt = $event->post_excerpt;
             } else {
                 $excerpt = $event->post_content;
             }
             $excerpt = Tribe__Events__Main::instance()->truncate($excerpt, 30);
             $category_classes = tribe_events_event_classes($event->ID, false);
             $json['eventId'] = $event->ID;
             $json['title'] = $event->post_title;
             $json['permalink'] = tribe_get_event_link($event->ID);
             $json['imageSrc'] = $image_src;
             $json['dateDisplay'] = $date_display;
             $json['imageTooltipSrc'] = $image_tool_src;
             $json['excerpt'] = $excerpt;
             $json['categoryClasses'] = $category_classes;
             /**
              * Template overrides (of month/tooltip.php) set up in 3.9.3 or earlier may still expect
              * these vars and will break without them, so they are being kept temporarily for
              * backwards compatibility purposes.
              *
              * @todo consider removing in 4.0
              */
             $json['startTime'] = tribe_get_start_date($event);
             $json['endTime'] = tribe_get_end_date($event);
         }
     }
     /**
      * Internationalization Strings
      */
     $json['i18n']['find_out_more'] = esc_attr__('Find out more »', 'tribe-events-calendar');
     $json['i18n']['for_date'] = esc_attr(sprintf(__('%s for', 'tribe-events-calendar'), tribe_get_event_label_plural()));
     if ($additional) {
         $json = array_merge((array) $json, (array) $additional);
     }
     $json = apply_filters('tribe_events_template_data_array', $json, $event, $additional);
     $json = tribe_prepare_for_json_deep($json);
     return json_encode($json);
 }
 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>';
 }
/**
 * Adds start time to event titles in Month view
 */
function tribe_add_start_time_to_event_title($post_title, $post_id)
{
    if (!tribe_is_event($post_id)) {
        return $post_title;
    }
    // Checks if it is the month view, modify this line to apply to more views
    //if ( !tribe_is_month() ) return $post_title;
    //---
    if (tribe_is_past() || tribe_is_upcoming() && !is_tax()) {
        $event_start_time = tribe_get_start_time($post_id);
        if (!empty($event_start_time)) {
            //   $post_title = $post_title . ' | ' . $event_start_time;
        }
        return $post_title;
    } else {
        return $post_title;
    }
}
Exemple #13
0
function dpd_2015_is_past_event($event_id)
{
    if (!tribe_is_event($event_id)) {
        return false;
    }
    $end_date = tribe_get_end_date($event_id, true, 'U');
    return time() > $end_date;
}
    <div class="col-md-4 col-sm-6 col-xs-12 dmbs-right">
        <?php 
//get the right sidebar
$blocks = array('firts_block', 'second_block');
dynamic_sidebar('Right Sidebar');
if (!(tribe_is_event(get_the_ID()) or get_the_ID() == 7)) {
    ?>



            <div class="services center-block">
                <h2>Services</h2>
                <div class="service-description">Please select an individual for information</div>
                <?php 
    print get_services();
    ?>
            </div>
            <div class="livestream">
                <?php 
    if (function_exists('ot_get_option')) {
        $watch_stream_link = ot_get_option('watch_stream_link');
        print $watch_stream_link;
    }
    ?>
            </div>
        <?php 
} else {
    $blocks = array_reverse($blocks);
}
?>
Exemple #15
0
 /**
  * Filters the permalink generated for a recurring event "all" view to remove aberrations.
  *
  * @param string $event_url
  * @param int    $event_id
  *
  * @return string
  */
 public function filter_tribe_events_pro_get_all_link($event_url, $event_id)
 {
     $post = get_post(Tribe__Main::post_id_helper($event_id));
     if (!tribe_is_event($post) || $post->post_parent != 0) {
         return $event_url;
     }
     $post_name = $post->post_name;
     // WPML might replace the post name with `<post_name>/<date>`; we undo that here.
     $event_url = preg_replace('~' . preg_quote($post_name) . '\\/\\d{4}-\\d{2}-\\d{2}~', $post_name, $event_url);
     return $event_url;
 }
Exemple #16
0
 /**
  * Adds / removes the event details as meta tags to the post.
  *
  * @param int     $postId
  * @param WP_Post $post
  *
  */
 public function addEventMeta($postId, $post)
 {
     static $avoid_recursion = false;
     // Avoid an infinite loop, because saveEventMeta calls wp_update_post when the post is set to always show in calendar
     if ($avoid_recursion) {
         return;
     }
     $avoid_recursion = true;
     $original_post = wp_is_post_revision($post);
     $is_event_revision = $original_post && tribe_is_event($original_post);
     if ($is_event_revision) {
         $revision = Tribe__Events__Revisions__Post::new_from_post($post);
         $revision->save();
         $avoid_recursion = false;
         return;
     }
     $event_meta = new Tribe__Events__Meta__Save($postId, $post);
     $event_meta->maybe_save();
     // Allow this callback to run
     $avoid_recursion = false;
 }
 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);
 }
 public function enqueue_scripts()
 {
     global $wp_styles, $woocommerce;
     $theme_info = wp_get_theme();
     wp_enqueue_script('jquery', false, array(), $theme_info->get('Version'), true);
     // the comment-reply script
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     if (function_exists('novagallery_shortcode')) {
         wp_deregister_script('novagallery_modernizr');
     }
     if (function_exists('ccgallery_shortcode')) {
         wp_deregister_script('ccgallery_modernizr');
     }
     if (Avada()->settings->get('status_gmap')) {
         $map_api = 'http' . (is_ssl() ? 's' : '') . '://maps.googleapis.com/maps/api/js?language=' . substr(get_locale(), 0, 2);
         wp_register_script('google-maps-api', $map_api, array(), $theme_info->get('Version'), false);
         wp_register_script('google-maps-infobox', 'http' . (is_ssl() ? 's' : '') . '://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox_packed.js', array(), $theme_info->get('Version'), false);
     }
     // Fix for WPML + Woocommerce
     // https://gist.github.com/mharis/8555367b1be5c2247a44
     if (class_exists('WooCommerce') && class_exists('SitePress')) {
         wp_deregister_script('wc-cart-fragments');
         wp_register_script('wc-cart-fragments', get_template_directory_uri() . '/assets/js/wc-cart-fragments.js', array('jquery', 'jquery-cookie'), $theme_info->get('Version'), true);
     }
     if (Avada()->settings->get('dev_mode')) {
         $main_js = get_template_directory_uri() . '/assets/js/theme.js';
         wp_deregister_script('bootstrap');
         wp_register_script('bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('bootstrap');
         wp_deregister_script('cssua');
         wp_register_script('cssua', get_template_directory_uri() . '/assets/js/cssua.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('cssua');
         wp_deregister_script('jquery.easyPieChart');
         wp_register_script('jquery.easyPieChart', get_template_directory_uri() . '/assets/js/jquery.easyPieChart.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.easyPieChart');
         wp_deregister_script('excanvas');
         wp_register_script('excanvas', get_template_directory_uri() . '/assets/js/excanvas.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('excanvas');
         wp_deregister_script('Froogaloop');
         wp_register_script('Froogaloop', get_template_directory_uri() . '/assets/js/Froogaloop.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('Froogaloop');
         wp_deregister_script('imagesLoaded');
         wp_register_script('imagesLoaded', get_template_directory_uri() . '/assets/js/imagesLoaded.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('imagesLoaded');
         wp_deregister_script('jquery.infinitescroll');
         wp_register_script('jquery.infinitescroll', get_template_directory_uri() . '/assets/js/jquery.infinitescroll.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.infinitescroll');
         wp_deregister_script('isotope');
         wp_register_script('isotope', get_template_directory_uri() . '/assets/js/isotope.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('isotope');
         wp_deregister_script('jquery.appear');
         wp_register_script('jquery.appear', get_template_directory_uri() . '/assets/js/jquery.appear.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.appear');
         wp_deregister_script('jquery.touchSwipe');
         wp_register_script('jquery.touchSwipe', get_template_directory_uri() . '/assets/js/jquery.touchSwipe.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.touchSwipe');
         wp_deregister_script('jquery.carouFredSel');
         wp_register_script('jquery.carouFredSel', get_template_directory_uri() . '/assets/js/jquery.carouFredSel.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.carouFredSel');
         wp_deregister_script('jquery.countTo');
         wp_register_script('jquery.countTo', get_template_directory_uri() . '/assets/js/jquery.countTo.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.countTo');
         wp_deregister_script('jquery.countdown');
         wp_register_script('jquery.countdown', get_template_directory_uri() . '/assets/js/jquery.countdown.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.countdown');
         wp_deregister_script('jquery.cycle');
         wp_register_script('jquery.cycle', get_template_directory_uri() . '/assets/js/jquery.cycle.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.cycle');
         wp_deregister_script('jquery.easing');
         wp_register_script('jquery.easing', get_template_directory_uri() . '/assets/js/jquery.easing.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.easing');
         wp_deregister_script('jquery.elasticslider');
         wp_register_script('jquery.elasticslider', get_template_directory_uri() . '/assets/js/jquery.elasticslider.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.elasticslider');
         wp_deregister_script('jquery.fitvids');
         wp_register_script('jquery.fitvids', get_template_directory_uri() . '/assets/js/jquery.fitvids.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.fitvids');
         wp_deregister_script('jquery.flexslider');
         wp_register_script('jquery.flexslider', get_template_directory_uri() . '/assets/js/jquery.flexslider.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.flexslider');
         wp_deregister_script('jquery.fusion_maps');
         wp_register_script('jquery.fusion_maps', get_template_directory_uri() . '/assets/js/jquery.fusion_maps.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.fusion_maps');
         wp_deregister_script('jquery.hoverflow');
         wp_register_script('jquery.hoverflow', get_template_directory_uri() . '/assets/js/jquery.hoverflow.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.hoverflow');
         wp_deregister_script('jquery.hoverIntent');
         wp_register_script('jquery.hoverIntent', get_template_directory_uri() . '/assets/js/jquery.hoverIntent.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.hoverIntent');
         wp_deregister_script('jquery.placeholder');
         wp_register_script('jquery.placeholder', get_template_directory_uri() . '/assets/js/jquery.placeholder.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.placeholder');
         wp_deregister_script('jquery.toTop');
         wp_register_script('jquery.toTop', get_template_directory_uri() . '/assets/js/jquery.toTop.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.toTop');
         wp_localize_script('jquery.toTop', 'toTopscreenReaderText', array('label' => esc_attr__('Go to Top', 'Avada')));
         wp_deregister_script('jquery.waypoints');
         wp_register_script('jquery.waypoints', get_template_directory_uri() . '/assets/js/jquery.waypoints.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.waypoints');
         wp_deregister_script('modernizr');
         wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/modernizr.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('modernizr');
         wp_deregister_script('jquery.requestAnimationFrame');
         wp_register_script('jquery.requestAnimationFrame', get_template_directory_uri() . '/assets/js/jquery.requestAnimationFrame.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.requestAnimationFrame');
         wp_deregister_script('jquery.mousewheel');
         wp_register_script('jquery.mousewheel', get_template_directory_uri() . '/assets/js/jquery.mousewheel.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('jquery.mousewheel');
         if (Avada()->settings->get('status_lightbox')) {
             wp_deregister_script('ilightbox.packed');
             wp_register_script('ilightbox.packed', get_template_directory_uri() . '/assets/js/ilightbox.js', array(), $theme_info->get('Version'), true);
             wp_enqueue_script('ilightbox.packed');
         }
         wp_deregister_script('avada-lightbox');
         wp_register_script('avada-lightbox', get_template_directory_uri() . '/assets/js/avada-lightbox.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('avada-lightbox');
         wp_deregister_script('avada-header');
         wp_register_script('avada-header', get_template_directory_uri() . '/assets/js/avada-header.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('avada-header');
         wp_deregister_script('avada-select');
         wp_register_script('avada-select', get_template_directory_uri() . '/assets/js/avada-select.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('avada-select');
         wp_deregister_script('avada-parallax');
         wp_register_script('avada-parallax', get_template_directory_uri() . '/assets/js/avada-parallax.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('avada-parallax');
         wp_deregister_script('avada-video-bg');
         wp_register_script('avada-video-bg', get_template_directory_uri() . '/assets/js/avada-video-bg.js', array(), $theme_info->get('Version'), true);
         wp_enqueue_script('avada-video-bg');
         if (class_exists('WooCommerce')) {
             wp_dequeue_script('avada-woocommerce');
             wp_register_script('avada-woocommerce', get_template_directory_uri() . '/assets/js/avada-woocommerce.js', array('jquery'), $theme_info->get('Version'), true);
             wp_enqueue_script('avada-woocommerce');
         }
         if (function_exists('is_bbpress') && is_bbpress()) {
             wp_dequeue_script('avada-bbpress');
             wp_register_script('avada-bbpress', get_template_directory_uri() . '/assets/js/avada-bbpress.js', array('jquery'), $theme_info->get('Version'), true);
             wp_enqueue_script('avada-bbpress');
         }
         if (class_exists('Tribe__Events__Main') && (tribe_is_event() || is_events_archive())) {
             wp_dequeue_script('avada-events');
             wp_register_script('avada-events', get_template_directory_uri() . '/assets/js/avada-events.js', array('jquery'), $theme_info->get('Version'), true);
             wp_enqueue_script('avada-events');
         }
         if (Avada()->settings->get('smooth_scrolling')) {
             wp_dequeue_script('jquery.nicescroll');
             wp_register_script('jquery.nicescroll', get_template_directory_uri() . '/assets/js/jquery.nicescroll.js', array('jquery'), $theme_info->get('Version'), true);
             wp_enqueue_script('jquery.nicescroll');
             wp_dequeue_script('avada-nicescroll');
             wp_register_script('avada-nicescroll', get_template_directory_uri() . '/assets/js/avada-nicescroll.js', array('jquery'), $theme_info->get('Version'), true);
             wp_enqueue_script('avada-nicescroll');
         }
     } else {
         $main_js = get_template_directory_uri() . '/assets/js/main.min.js';
     }
     wp_deregister_script('avada');
     wp_register_script('avada', $main_js, array(), $theme_info->get('Version'), true);
     wp_enqueue_script('avada');
     wp_localize_script('avada', 'toTopscreenReaderText', array('label' => esc_attr__('Go to Top', 'Avada')));
     $smoothHeight = 'auto' == get_post_meta($this->page_id(), 'pyre_fimg_width', true) && 'half' == get_post_meta($this->page_id(), 'pyre_width', true) ? 'true' : 'false';
     if (get_post_meta('auto' == $this->page_id(), 'pyre_fimg_width', true) && 'half' == get_post_meta($this->page_id(), 'pyre_width', true)) {
         $flex_smoothHeight = 'true';
     } else {
         $flex_smoothHeight = Avada()->settings->get('slideshow_smooth_height') ? 'true' : 'false';
     }
     $db_vars = Avada()->settings->get_all();
     $db_vars['slideshow_autoplay'] = !Avada()->settings->get('slideshow_autoplay') ? false : true;
     $db_vars['slideshow_speed'] = !Avada()->settings->get('slideshow_speed') ? 7000 : Avada()->settings->get('slideshow_speed');
     $current_page_template = get_page_template_slug($this->page_id());
     $portfolio_image_size = avada_get_portfolio_image_size($this->page_id());
     $isotope_type = $portfolio_image_size == 'full' ? 'masonry' : 'fitRows';
     if (is_archive()) {
         $portfolio_layout_setting = strtolower(Avada()->settings->get('portfolio_archive_layout'));
         $isotope_type = Avada()->settings->get('portfolio_featured_image_size') == 'full' || strpos($portfolio_layout_setting, 'grid') ? 'masonry' : 'fitRows';
     }
     $layout = get_post_meta($this->page_id(), 'pyre_page_bg_layout', true) == 'boxed' || get_post_meta($this->page_id(), 'pyre_page_bg_layout', true) == 'wide' ? get_post_meta($this->page_id(), 'pyre_page_bg_layout', true) : Avada()->settings->get('layout');
     $avada_rev_styles = 'no' == get_post_meta($this->page_id(), 'pyre_avada_rev_styles', true) || Avada()->settings->get('avada_rev_styles') && 'yes' != get_post_meta($this->page_id(), 'pyre_avada_rev_styles', true) ? 1 : 0;
     $local_variables = array('admin_ajax' => admin_url('admin-ajax.php'), 'admin_ajax_nonce' => wp_create_nonce('avada_admin_ajax'), 'protocol' => is_ssl(), 'theme_url' => get_template_directory_uri(), 'dropdown_goto' => __('Go to...', 'Avada'), 'mobile_nav_cart' => __('Shopping Cart', 'Avada'), 'page_smoothHeight' => $smoothHeight, 'flex_smoothHeight' => $flex_smoothHeight, 'language_flag' => Avada_Multilingual::get_active_language(), 'infinite_blog_finished_msg' => '<em>' . __('All posts displayed.', 'Avada') . '</em>', 'infinite_finished_msg' => '<em>' . __('All items displayed.', 'Avada') . '</em>', 'infinite_blog_text' => '<em>' . __('Loading the next set of posts...', 'Avada') . '</em>', 'portfolio_loading_text' => '<em>' . __('Loading Portfolio Items...', 'Avada') . '</em>', 'faqs_loading_text' => '<em>' . __('Loading FAQ Items...', 'Avada') . '</em>', 'order_actions' => __('Details', 'Avada'), 'avada_rev_styles' => $avada_rev_styles, 'avada_styles_dropdowns' => Avada()->settings->get('avada_styles_dropdowns'), 'blog_grid_column_spacing' => Avada()->settings->get('blog_grid_column_spacing'), 'blog_pagination_type' => Avada()->settings->get('blog_pagination_type'), 'carousel_speed' => Avada()->settings->get('carousel_speed'), 'counter_box_speed' => intval(Avada()->settings->get('counter_box_speed')), 'content_break_point' => intval(Avada()->settings->get('content_break_point')), 'disable_mobile_animate_css' => Avada()->settings->get('disable_mobile_animate_css'), 'disable_mobile_image_hovers' => Avada()->settings->get('disable_mobile_image_hovers'), 'portfolio_pagination_type' => Avada()->settings->get('grid_pagination_type'), 'form_bg_color' => Avada()->settings->get('form_bg_color'), 'header_transparency' => '1' !== Avada_Color::get_alpha_from_rgba(Avada()->settings->get('header_bg_color')) && !get_post_meta($this->page_id(), 'pyre_header_bg_opacity', true) || '' != get_post_meta($this->page_id(), 'pyre_header_bg_opacity', true) && 1 > get_post_meta($this->page_id(), 'pyre_header_bg_opacity', true) ? 1 : 0, 'header_padding_bottom' => Avada()->settings->get('header_padding', 'bottom'), 'header_padding_top' => Avada()->settings->get('header_padding', 'top'), 'header_position' => Avada()->settings->get('header_position'), 'header_sticky' => Avada()->settings->get('header_sticky'), 'header_sticky_tablet' => Avada()->settings->get('header_sticky_tablet'), 'header_sticky_mobile' => Avada()->settings->get('header_sticky_mobile'), 'header_sticky_type2_layout' => Avada()->settings->get('header_sticky_type2_layout'), 'sticky_header_shrinkage' => Avada()->settings->get('header_sticky_shrinkage'), 'is_responsive' => Avada()->settings->get('responsive'), 'is_ssl' => is_ssl() ? 'true' : 'false', 'isotope_type' => $isotope_type, 'layout_mode' => strtolower($layout), 'lightbox_animation_speed' => Avada()->settings->get('lightbox_animation_speed'), 'lightbox_arrows' => Avada()->settings->get('lightbox_arrows'), 'lightbox_autoplay' => Avada()->settings->get('lightbox_autoplay'), 'lightbox_behavior' => Avada()->settings->get('lightbox_behavior'), 'lightbox_desc' => Avada()->settings->get('lightbox_desc'), 'lightbox_deeplinking' => Avada()->settings->get('lightbox_deeplinking'), 'lightbox_gallery' => Avada()->settings->get('lightbox_gallery'), 'lightbox_opacity' => Avada()->settings->get('lightbox_opacity'), 'lightbox_path' => Avada()->settings->get('lightbox_path'), 'lightbox_post_images' => Avada()->settings->get('lightbox_post_images'), 'lightbox_skin' => Avada()->settings->get('lightbox_skin'), 'lightbox_slideshow_speed' => (int) Avada()->settings->get('lightbox_slideshow_speed'), 'lightbox_social' => Avada()->settings->get('lightbox_social'), 'lightbox_title' => Avada()->settings->get('lightbox_title'), 'lightbox_video_height' => Avada_Sanitize::number(Avada()->settings->get('lightbox_video_dimensions', 'height')), 'lightbox_video_width' => Avada_Sanitize::number(Avada()->settings->get('lightbox_video_dimensions', 'width')), 'logo_alignment' => Avada()->settings->get('logo_alignment'), 'logo_margin_bottom' => Avada()->settings->get('logo_margin', 'bottom'), 'logo_margin_top' => Avada()->settings->get('logo_margin', 'top'), 'megamenu_max_width' => (int) Avada()->settings->get('megamenu_max_width'), 'mobile_menu_design' => Avada()->settings->get('mobile_menu_design'), 'nav_height' => (int) Avada()->settings->get('nav_height'), 'nav_highlight_border' => (int) Avada()->settings->get('nav_highlight_border'), 'page_title_fading' => Avada()->settings->get('page_title_fading'), 'pagination_video_slide' => Avada()->settings->get('pagination_video_slide'), 'related_posts_speed' => Avada()->settings->get('related_posts_speed'), 'submenu_slideout' => Avada()->settings->get('mobile_nav_submenu_slideout'), 'side_header_break_point' => (int) Avada()->settings->get('side_header_break_point'), 'sidenav_behavior' => Avada()->settings->get('sidenav_behavior'), 'site_width' => Avada()->settings->get('site_width'), 'slider_position' => get_post_meta($this->page_id(), 'pyre_slider_position', true) && 'default' != get_post_meta($this->page_id(), 'pyre_slider_position', true) ? get_post_meta($this->page_id(), 'pyre_slider_position', true) : strtolower(Avada()->settings->get('slider_position')), 'slideshow_autoplay' => Avada()->settings->get('slideshow_autoplay'), 'slideshow_speed' => Avada()->settings->get('slideshow_speed'), 'smooth_scrolling' => Avada()->settings->get('smooth_scrolling'), 'status_lightbox' => Avada()->settings->get('status_lightbox'), 'status_totop_mobile' => Avada()->settings->get('status_totop_mobile'), 'status_vimeo' => Avada()->settings->get('status_vimeo'), 'status_yt' => Avada()->settings->get('status_yt'), 'submenu_slideout' => Avada()->settings->get('mobile_nav_submenu_slideout'), 'testimonials_speed' => Avada()->settings->get('testimonials_speed'), 'tfes_animation' => Avada()->settings->get('tfes_animation'), 'tfes_autoplay' => Avada()->settings->get('tfes_autoplay'), 'tfes_interval' => (int) Avada()->settings->get('tfes_interval'), 'tfes_speed' => (int) Avada()->settings->get('tfes_speed'), 'tfes_width' => (int) Avada()->settings->get('tfes_width'), 'title_style_type' => Avada()->settings->get('title_style_type'), 'title_margin_top' => Avada()->settings->get('title_margin', 'top'), 'title_margin_bottom' => Avada()->settings->get('title_margin', 'bottom'), 'typography_responsive' => Avada()->settings->get('typography_responsive'), 'typography_sensitivity' => Avada()->settings->get('typography_sensitivity'), 'typography_factor' => Avada()->settings->get('typography_factor'), 'woocommerce_shop_page_columns' => Avada()->settings->get('woocommerce_shop_page_columns'));
     if (class_exists('WooCommerce')) {
         if (version_compare($woocommerce->version, '2.3', '>=')) {
             $local_variables['woocommerce_23'] = true;
         }
     }
     $local_variables['side_header_width'] = 'Top' != Avada()->settings->get('header_position') ? intval(Avada()->settings->get('side_header_width')) : '0';
     wp_localize_script('avada', 'js_local_vars', $local_variables);
     wp_enqueue_style('avada-stylesheet', get_stylesheet_uri(), array(), $theme_info->get('Version'));
     wp_enqueue_style('avada-shortcodes', get_template_directory_uri() . '/shortcodes.css', array(), $theme_info->get('Version'));
     $wp_styles->add_data('avada-shortcodes', 'conditional', 'lte IE 9');
     if (Avada()->settings->get('status_fontawesome')) {
         wp_enqueue_style('fontawesome', get_template_directory_uri() . '/assets/fonts/fontawesome/font-awesome.css', array(), $theme_info->get('Version'));
         wp_enqueue_style('avada-IE-fontawesome', get_template_directory_uri() . '/assets/fonts/fontawesome/font-awesome.css', array(), $theme_info->get('Version'));
         $wp_styles->add_data('avada-IE-fontawesome', 'conditional', 'lte IE 9');
     }
     wp_enqueue_style('avada-IE8', get_template_directory_uri() . '/assets/css/ie8.css', array(), $theme_info->get('Version'));
     $wp_styles->add_data('avada-IE8', 'conditional', 'lte IE 8');
     wp_enqueue_style('avada-IE', get_template_directory_uri() . '/assets/css/ie.css', array(), $theme_info->get('Version'));
     $wp_styles->add_data('avada-IE', 'conditional', 'IE');
     wp_deregister_style('woocommerce-layout');
     wp_deregister_style('woocommerce-smallscreen');
     wp_deregister_style('woocommerce-general');
     if (Avada()->settings->get('status_lightbox')) {
         wp_enqueue_style('avada-iLightbox', get_template_directory_uri() . '/ilightbox.css', array(), $theme_info->get('Version'));
     }
     if (Avada()->settings->get('use_animate_css')) {
         wp_enqueue_style('avada-animations', get_template_directory_uri() . '/animations.css', array(), $theme_info->get('Version'));
     }
     if (class_exists('WooCommerce')) {
         wp_enqueue_style('avada-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce.css', array(), $theme_info->get('Version'));
     }
     if (class_exists('bbPress')) {
         wp_enqueue_style('avada-bbpress', get_template_directory_uri() . '/assets/css/bbpress.css', array(), $theme_info->get('Version'));
     }
     if (Avada()->settings->get('status_lightbox') && class_exists('WooCommerce')) {
         wp_dequeue_script('prettyPhoto');
         wp_dequeue_script('prettyPhoto-init');
         wp_dequeue_style('woocommerce_prettyPhoto_css');
     }
     if (is_rtl()) {
         wp_enqueue_style('avada-rtl', get_template_directory_uri() . '/assets/css/rtl.css', array(), $theme_info->get('Version'));
     }
 }
 /**
  * Prepare the full output of the breadcrumb path
  *
  * @return void
  */
 private function prepare_breadcrumb_html()
 {
     // Add the path prefix
     $this->html_markup = $this->get_breadcrumb_prefix();
     // Add the "Home" link
     $this->html_markup .= $this->get_breadcrumb_home();
     // Woocommerce path prefix (e.g "Shop" )
     if (class_exists('Woocommerce') && (is_woocommerce() && is_archive() && !is_shop() || is_cart() || is_checkout() || is_account_page())) {
         $this->html_markup .= $this->get_woocommerce_shop_page();
     }
     // bbPress path prefix (e.g "Forums" )
     if (class_exists('bbPress') && is_bbpress() && (bbp_is_topic_archive() || bbp_is_single_user() || bbp_is_search())) {
         $this->html_markup .= $this->get_bbpress_main_archive_page();
     }
     // Single Posts and Pages (of all post types)
     if (is_singular()) {
         // If the post type of the current post has an archive link, display the archive breadcrumb
         if (isset($this->post->post_type) && get_post_type_archive_link($this->post->post_type) && $this->show_post_type_archive) {
             $this->html_markup .= $this->get_post_type_archive();
         }
         // If the post doesn't have parents
         if (isset($this->post->post_parent) && $this->post->post_parent == 0) {
             $this->html_markup .= $this->get_post_terms();
             // If there are parents; mostly for pages
         } else {
             $this->html_markup .= $this->get_post_ancestors();
         }
         $this->html_markup .= $this->get_breadcrumb_leaf_markup();
     } else {
         // Custom post types archives
         if (is_post_type_archive()) {
             $this->html_markup .= $this->get_post_type_archive(FALSE);
             // Search on custom post type (e.g. Woocommerce)
             if (is_search()) {
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('search');
             }
             // Taxonomy Archives
         } elseif (is_tax() || is_tag() || is_category()) {
             // If we have a tag archive, add the tag prefix
             if (is_tag()) {
                 $this->html_markup .= $this->tag_archive_prefix;
             }
             $this->html_markup .= $this->get_taxonomies();
             $this->html_markup .= $this->get_breadcrumb_leaf_markup('term');
             // Date Archives
         } elseif (is_date()) {
             global $wp_locale;
             // Set variables
             $year = esc_html(get_query_var('year'));
             if (is_month() || is_day()) {
                 $month = get_query_var('monthnum');
                 $month_name = $wp_locale->get_month($month);
             }
             // Year Archive, only is a leaf
             if (is_year()) {
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('year');
                 // Month Archive, needs year link and month leaf
             } elseif (is_month()) {
                 $this->html_markup .= $this->get_single_breadcrumb_markup($year, get_year_link($year));
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('month');
                 // Day Archive, needs year and month link and day leaf
             } elseif (is_day()) {
                 $this->html_markup .= $this->get_single_breadcrumb_markup($year, get_year_link($year));
                 $this->html_markup .= $this->get_single_breadcrumb_markup($month_name, get_month_link($year, $month));
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('day');
             }
             // Author Archives
         } elseif (is_author()) {
             $this->html_markup .= $this->get_breadcrumb_leaf_markup('author');
             // Search Page
         } elseif (is_search()) {
             $this->html_markup .= $this->get_breadcrumb_leaf_markup('search');
             // 404 Page
         } elseif (is_404()) {
             // Special treatment for Events Calendar to avoid 404 messages on list view
             if (class_exists('TribeEvents') && tribe_is_event() || is_events_archive()) {
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('events');
                 // Default case
             } else {
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('404');
             }
             // bbPress
         } elseif (class_exists('bbPress')) {
             // Search Page
             if (bbp_is_search()) {
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('bbpress_search');
                 // User page
             } elseif (bbp_is_single_user()) {
                 $this->html_markup .= $this->get_breadcrumb_leaf_markup('bbpress_user');
             }
         }
     }
 }
Exemple #20
0
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;
}
 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;
 }
Exemple #22
0
 /**
  * Update post classes
  *
  * @param array $classes
  *
  * @return array
  * @TODO move this to template class
  */
 public function post_class($classes)
 {
     global $post;
     if (is_object($post) && isset($post->post_type) && $post->post_type == self::POSTTYPE && ($terms = get_the_terms($post->ID, self::TAXONOMY))) {
         foreach ($terms as $term) {
             $classes[] = 'cat_' . sanitize_html_class($term->slug, $term->term_taxonomy_id);
         }
     }
     // Remove the .hentry class if it is a single event page (it is positioned elsewhere in the template markup)
     if (tribe_is_event($post->ID) && is_singular() && in_array('hentry', $classes)) {
         unset($classes[array_search('hentry', $classes)]);
     }
     return $classes;
 }
Exemple #23
0
$sidebar_1 = get_post_meta($c_pageID, 'sbg_selected_sidebar_replacement', true);
$sidebar_2 = get_post_meta($c_pageID, 'sbg_selected_sidebar_2_replacement', true);
if (is_single() && !is_singular('avada_portfolio') && !is_singular('product') && !is_bbpress()) {
    if ($smof_data['posts_global_sidebar']) {
        if ($smof_data['posts_sidebar'] != 'None') {
            $sidebar_1 = array($smof_data['posts_sidebar']);
        } else {
            $sidebar_1 = '';
        }
        if ($smof_data['posts_sidebar_2'] != 'None') {
            $sidebar_2 = array($smof_data['posts_sidebar_2']);
        } else {
            $sidebar_2 = '';
        }
    }
    if (class_exists('TribeEvents') && tribe_is_event($c_pageID) && $smof_data['pages_global_sidebar']) {
        if ($smof_data['pages_sidebar'] != 'None') {
            $sidebar_1 = array($smof_data['pages_sidebar']);
        } else {
            $sidebar_1 = '';
        }
        if ($smof_data['pages_sidebar_2'] != 'None') {
            $sidebar_2 = array($smof_data['pages_sidebar_2']);
        } else {
            $sidebar_2 = '';
        }
    }
} else {
    if (is_singular('avada_portfolio')) {
        if ($smof_data['portfolio_global_sidebar']) {
            if ($smof_data['portfolio_sidebar'] != 'None') {
 /**
  * @deprecated
  */
 function is_event($postId = null)
 {
     _deprecated_function(__FUNCTION__, '2.0', 'tribe_is_event()');
     return tribe_is_event($postId);
 }
Exemple #25
0
 if (is_category() or is_tax()) {
     ?>
             <div class="tagline">
                 <?php 
     echo category_description();
     ?>
             </div>
             <?php 
 }
 ?>
             <h1>
                 <?php 
 if (tribe_is_month()) {
     echo 'Events';
 } else {
     if (tribe_is_event() && !tribe_is_day() && !is_single()) {
         echo 'Events';
     } else {
         if (is_singular('tribe_events')) {
             echo 'Events';
         } else {
             if (tribe_is_day()) {
                 echo 'Events';
             } else {
                 if (tribe_is_upcoming()) {
                     echo 'Events';
                 } else {
                     if (tribe_is_past()) {
                         echo 'Events';
                     } else {
                         echo roots_title();
Exemple #26
0
     $medium = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'medium');
     $medium = $medium[0];
     $large = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'large');
     $large = $large[0];
 } else {
     if (tribe_is_event() && tribe_is_day() && !is_single()) {
         $pageid = jtd_get_id_by_slug('events');
         $alt = get_the_title($pageid);
         $small = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'small');
         $small = $small[0];
         $medium = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'medium');
         $medium = $medium[0];
         $large = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'large');
         $large = $large[0];
     } else {
         if (tribe_is_event() && is_single()) {
             $small = wp_get_attachment_image_src(get_post_thumbnail_id(), 'small');
             $medium = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium');
             $large = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
         } else {
             if (is_tax('tribe_events_cat')) {
                 $qo = get_queried_object();
                 $term_id = $qo->term_id;
                 $term_tax = $qo->taxonomy;
                 $banner = get_field('banner_image', $term_tax . '_' . $term_id);
                 $alt = $banner['alt'];
                 $sizes = $banner['sizes'];
                 $small = $sizes['small'];
                 $medium = $sizes['medium'];
                 $large = $sizes['large'];
             }
Exemple #27
0
 /**
  * override default wp_terms_checklist arguments to prevent checked items from bubbling to the
  * top. Instead, retain hierarchy.
  */
 public function prevent_checked_on_top_terms($args, $post_id)
 {
     $post = get_post($post_id);
     if (!tribe_is_event($post)) {
         return $args;
     }
     $args['checked_ontop'] = false;
     return $args;
 }
 /**
  * Returns the sidebar-1 & sidebar-2 context.
  *
  * @var  int 1/2
  * @return mixed
  */
 public function sidebar_context($sidebar = 1)
 {
     $c_pageID = Avada::c_pageID();
     $sidebar_1 = get_post_meta($c_pageID, 'sbg_selected_sidebar_replacement', true);
     $sidebar_2 = get_post_meta($c_pageID, 'sbg_selected_sidebar_2_replacement', true);
     if (is_single() && !is_singular('avada_portfolio') && !is_singular('product') && !is_bbpress() && !is_buddypress()) {
         if (Avada()->settings->get('posts_global_sidebar')) {
             $sidebar_1 = 'None' != Avada()->settings->get('posts_sidebar') ? array(Avada()->settings->get('posts_sidebar')) : '';
             $sidebar_2 = 'None' != Avada()->settings->get('posts_sidebar_2') ? array(Avada()->settings->get('posts_sidebar_2')) : '';
         }
         if (class_exists('Tribe__Events__Main') && tribe_is_event($c_pageID) && Avada()->settings->get('pages_global_sidebar')) {
             $sidebar_1 = 'None' != Avada()->settings->get('pages_sidebar') ? array(Avada()->settings->get('pages_sidebar')) : '';
             $sidebar_2 = 'None' != Avada()->settings->get('pages_sidebar_2') ? array(Avada()->settings->get('pages_sidebar_2')) : '';
         }
     } elseif (is_singular('avada_portfolio')) {
         if (Avada()->settings->get('portfolio_global_sidebar')) {
             $sidebar_1 = 'None' != Avada()->settings->get('portfolio_sidebar') ? array(Avada()->settings->get('portfolio_sidebar')) : '';
             $sidebar_2 = 'None' != Avada()->settings->get('portfolio_sidebar_2') ? array(Avada()->settings->get('portfolio_sidebar_2')) : '';
         }
     } elseif (is_singular('product') || class_exists('WooCommerce') && is_shop()) {
         if (Avada()->settings->get('woo_global_sidebar')) {
             $sidebar_1 = 'None' != Avada()->settings->get('woo_sidebar') ? array(Avada()->settings->get('woo_sidebar')) : '';
             $sidebar_2 = 'None' != Avada()->settings->get('woo_sidebar_2') ? array(Avada()->settings->get('woo_sidebar_2')) : '';
         }
     } elseif ((is_page() || is_page_template()) && (!is_page_template('100-width.php') && !is_page_template('blank.php'))) {
         if (Avada()->settings->get('pages_global_sidebar')) {
             $sidebar_1 = 'None' != Avada()->settings->get('pages_sidebar') ? array(Avada()->settings->get('pages_sidebar')) : '';
             $sidebar_2 = 'None' != Avada()->settings->get('pages_sidebar_2') ? array(Avada()->settings->get('pages_sidebar_2')) : '';
         }
     }
     if (is_home()) {
         $sidebar_1 = Avada()->settings->get('blog_archive_sidebar');
         $sidebar_2 = Avada()->settings->get('blog_archive_sidebar_2');
     }
     if (is_archive() && (!is_buddypress() && !is_bbpress() && (class_exists('WooCommerce') && !is_shop()) || !class_exists('WooCommerce')) && !is_tax('portfolio_category') && !is_tax('portfolio_skills') && !is_tax('portfolio_tags') && !is_tax('product_cat') && !is_tax('product_tag')) {
         $sidebar_1 = Avada()->settings->get('blog_archive_sidebar');
         $sidebar_2 = Avada()->settings->get('blog_archive_sidebar_2');
     }
     if (is_tax('portfolio_category') || is_tax('portfolio_skills') || is_tax('portfolio_tags')) {
         $sidebar_1 = Avada()->settings->get('portfolio_archive_sidebar');
         $sidebar_2 = Avada()->settings->get('portfolio_archive_sidebar_2');
     }
     if (is_tax('product_cat') || is_tax('product_tag')) {
         $sidebar_1 = Avada()->settings->get('woocommerce_archive_sidebar');
         $sidebar_2 = Avada()->settings->get('woocommerce_archive_sidebar_2');
     }
     if (is_search()) {
         $sidebar_1 = Avada()->settings->get('search_sidebar');
         $sidebar_2 = Avada()->settings->get('search_sidebar_2');
     }
     if ((is_bbpress() || is_buddypress()) && !bbp_is_forum_archive() && !bbp_is_topic_archive() && !bbp_is_user_home() && !bbp_is_search()) {
         $sidebar_1 = Avada()->settings->get('ppbress_sidebar');
         $sidebar_2 = Avada()->settings->get('ppbress_sidebar_2');
         if (Avada()->settings->get('bbpress_global_sidebar')) {
             $sidebar_1 = Avada()->settings->get('ppbress_sidebar');
             $sidebar_2 = Avada()->settings->get('ppbress_sidebar_2');
         } else {
             $sidebar_1 = get_post_meta($c_pageID, 'sbg_selected_sidebar_replacement', true);
             $sidebar_2 = get_post_meta($c_pageID, 'sbg_selected_sidebar_2_replacement', true);
         }
     }
     if ((is_bbpress() || is_buddypress()) && (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search())) {
         $sidebar_1 = Avada()->settings->get('ppbress_sidebar');
         $sidebar_2 = Avada()->settings->get('ppbress_sidebar_2');
     }
     if (class_exists('Tribe__Events__Main') && is_events_archive()) {
         $sidebar_1 = 'None' != Avada()->settings->get('pages_sidebar') ? array(Avada()->settings->get('pages_sidebar')) : 'None';
         $sidebar_2 = 'None' != Avada()->settings->get('pages_sidebar_2') ? array(Avada()->settings->get('pages_sidebar_2')) : 'None';
     }
     if (1 == $sidebar) {
         return $sidebar_1;
     } elseif (2 == $sidebar) {
         return $sidebar_2;
     }
 }
function avada_current_page_title_bar($post_id)
{
    global $smof_data;
    ob_start();
    if ($smof_data['breadcrumb']) {
        if ($smof_data['page_title_bar_bs'] == 'Breadcrumbs') {
            if (class_exists('Woocommerce') && is_woocommerce() || (is_tax('product_cat') || is_tax('product_tag'))) {
                woocommerce_breadcrumb(array('wrap_before' => '<ul class="breadcrumbs">', 'wrap_after' => '</ul>', 'before' => '<li>', 'after' => '</li>', 'delimiter' => ''));
            } else {
                if (class_exists('bbPress') && is_bbpress()) {
                    bbp_breadcrumb(array('before' => '<ul class="breadcrumbs">', 'after' => '</ul>', 'sep' => ' ', 'crumb_before' => '<li>', 'crumb_after' => '</li>', 'home_text' => __('Home', 'Avada')));
                } else {
                    themefusion_breadcrumb();
                }
            }
        } else {
            get_search_form();
        }
    }
    $secondary_content = ob_get_contents();
    ob_get_clean();
    $title = '';
    $subtitle = '';
    if (get_post_meta($post_id, 'pyre_page_title_custom_text', true) != '') {
        $title = get_post_meta($post_id, 'pyre_page_title_custom_text', true);
    }
    if (get_post_meta($post_id, 'pyre_page_title_custom_subheader', true) != '') {
        $subtitle = get_post_meta($post_id, 'pyre_page_title_custom_subheader', true);
    }
    if (!$title) {
        $title = get_the_title();
        if (is_home()) {
            $title = $smof_data['blog_title'];
        }
        if (is_search()) {
            $title = __('Rezultati pretrage za:', 'Avada') . get_search_query();
        }
        if (is_404()) {
            $title = __('Error 404 Page', 'Avada');
        }
        if (class_exists('TribeEvents') && tribe_is_event() && !is_single() || class_exists('TribeEvents') && is_events_archive() && is_404()) {
            $title = tribe_get_events_title();
        }
        if (is_archive() && !is_bbpress()) {
            if (is_day()) {
                $title = __('Dnevna arhiva:', 'Avada') . '<span> ' . get_the_date() . '</span>';
            } else {
                if (is_month()) {
                    $title = __('Mjesečna arhiva:', 'Avada') . '<span> ' . get_the_date(_x('F Y', 'monthly archives date format', 'Avada')) . '</span>';
                } elseif (is_year()) {
                    $title = __('Godišnja arhiva:', 'Avada') . '<span> ' . get_the_date(_x('Y', 'yearly archives date format', 'Avada')) . '</span>';
                } elseif (is_author()) {
                    $curauth = get_user_by('id', get_query_var('author'));
                    $title = $curauth->nickname;
                } else {
                    $title = single_cat_title('', false);
                }
            }
        }
        if (class_exists('Woocommerce') && is_woocommerce() && (is_product() || is_shop()) && !is_search()) {
            if (!is_product()) {
                $title = woocommerce_page_title(false);
            }
        }
    }
    if (!$subtitle) {
        if (is_home()) {
            $subtitle = $smof_data['blog_subtitle'];
        }
    }
    if (!is_archive() && !is_search() && !(is_home() && !is_front_page())) {
        if (get_post_meta($post_id, 'pyre_page_title', true) == 'yes' || $smof_data['page_title_bar'] && get_post_meta($post_id, 'pyre_page_title', true) != 'no') {
            if (get_post_meta($post_id, 'pyre_page_title_text', true) == 'no') {
                $title = '';
                $subtitle = '';
            }
            if (is_home() && is_front_page() && !$smof_data['blog_show_page_title_bar']) {
                // do nothing
            } else {
                avada_page_title_bar($title, $subtitle, $secondary_content);
            }
        }
    } else {
        if (is_home() && !$smof_data['blog_show_page_title_bar']) {
            // do nothing
        } else {
            if ($smof_data['page_title_bar']) {
                avada_page_title_bar($title, $subtitle, $secondary_content);
            }
        }
    }
}
Exemple #30
0
 /**
  * @return int
  */
 protected function get_event_id()
 {
     if ($this->is_previewing()) {
         global $wp_query;
         return $wp_query->is_preview() && tribe_is_event($wp_query->post) ? $wp_query->post->ID : $_GET['preview_id'];
     } else {
         if ($this->is_saving_preview()) {
             return $_POST['post_ID'];
         }
     }
     return 0;
 }