has_hijacked_posts() ) { $page_template->restore_main_query(); add_action( 'loop_start', [ $page_template, 'hijack_on_loop_start' ], 1000 ); } } } /** * Open the wrapper before the title. * * @access public */ public function before_the_title() { echo '
'; } /** * Close the wrapper after the title. * * @access public */ public function after_the_title() { echo '
'; } /** * Removes arrows from the "previous" link. * * @access public * @param string $anchor The HTML. * @return string */ public function remove_arrow_from_prev_link( $anchor ) { return tribe_get_prev_event_link( '%title%' ); } /** * Removes arrows from the "next" link. * * @access public * @param string $anchor The HTML. * @return string */ public function remove_arrow_from_next_link( $anchor ) { return tribe_get_next_event_link( '%title%' ); } /** * Returns the mobile breakpoint. * * @access public * @return int */ public function set_mobile_breakpoint() { return intval( Avada()->settings->get( 'content_break_point' ) ); } /** * Renders the title for single events. * * @access public */ public static function render_single_event_title() { $event_id = get_the_ID(); ?>
', '' ); ?>
', '' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> |
'; } /** * Renders to correct excerpts on archive pages. * * @since 5.1.6 * @access public * @param string $excerpt The post excerpt. * @param object $_post The post object. * @return string The new excerpt. */ public function get_the_excerpt( $excerpt, $_post ) { global $post; if ( false !== strpos( get_post_type( $_post->ID ), 'tribe_' ) && is_archive() && ! empty( $post->ID ) && $post->ID === $_post->ID ) { return fusion_get_post_content( $post->ID, 'yes', apply_filters( 'excerpt_length', 55 ), true ); } return $excerpt; } /** * Add packery library to the Events Calendar Photo View shortcode. * * @since 5.3.1 * @access public * @return void */ public function add_packery_library_to_photo_view() { $version = Avada::get_theme_version(); wp_enqueue_script( 'tribe-events-pro-isotope-packery', FUSION_LIBRARY_URL . '/assets/min/js/library/packery.js', [ 'tribe-events-pro-isotope' ], $version, true ); } /** * Add CSS to hide incompatible customizer controls. * * @since 5.5.0 * @access public * @return void */ public function ec_customizer_styles() { ?> add_setting( $customizer->get_setting_name( 'avada_ec_notice_post_title_color', $section ), [ 'type' => 'hidden', ] ); $manager->add_control( 'avada_ec_notice_post_title_color', [ 'label' => __( 'NOTE', 'Avada' ), /* translators: EC Customizer notice. */ 'description' => sprintf( __( 'You can control the post title color from the Avada Global Options panel through the Events Primary Color Overlay Text Color setting. Avada has additional Event Calendar settings in Global Options.', 'Avada' ), Avada()->settings->get_setting_link( 'primary_overlay_text_color' ), Avada()->settings->get_setting_link( 'primary_overlay_text_color' ) ), 'section' => $section->id, 'settings' => $customizer->get_setting_name( 'avada_ec_notice_post_title_color', $section ), 'type' => 'hidden', ] ); } /** * Add notice to Events Calendar photo view customizer section. * * @since 5.5.0 * @access public * @param WP_Customize_Section $section The WordPress section instance. * @param WP_Customize_Manager $manager The WordPress Customizer manager. * @return void */ public function add_photo_view_notice( WP_Customize_Section $section, WP_Customize_Manager $manager ) { $customizer = Tribe__Customizer::instance(); $manager->add_setting( $customizer->get_setting_name( 'avada_ec_notice_photo_bg_color', $section ), [ 'type' => 'hidden', ] ); $manager->add_control( 'avada_ec_notice_photo_bg_color', [ 'label' => __( 'NOTE', 'Avada' ), /* translators: EC Customizer notice. */ 'description' => sprintf( __( 'You can control the photo background color from Avada\'s Global Options panel through the Grid Box Color setting. Avada has additional Event Calendar settings in Global Options.', 'Avada' ), Avada()->settings->get_setting_link( 'timeline_bg_color' ), Avada()->settings->get_setting_link( 'primary_overlay_text_color' ) ), 'section' => $section->id, 'settings' => $customizer->get_setting_name( 'avada_ec_notice_photo_bg_color', $section ), 'type' => 'hidden', ] ); } /** * Add notice to Events Calendar month/week view customizer section. * * @since 5.5.0 * @access public * @param WP_Customize_Section $section The WordPress section instance. * @param WP_Customize_Manager $manager The WordPress Customizer manager. * @return void */ public function add_month_week_view_notice( WP_Customize_Section $section, WP_Customize_Manager $manager ) { $customizer = Tribe__Customizer::instance(); $manager->add_setting( $customizer->get_setting_name( 'avada_ec_notice_highlight_color', $section ), [ 'type' => 'hidden', ] ); $manager->add_control( 'avada_ec_notice_highlight_color', [ 'label' => __( 'NOTE', 'Avada' ), /* translators: EC Customizer notice. */ 'description' => sprintf( __( 'You can control the calendar highlight color from Avada\'s Global Options panel through the Primary Color setting. Avada has additional Event Calendar settings in Global Options.', 'Avada' ), Avada()->settings->get_setting_link( 'primary_color' ), Avada()->settings->get_setting_link( 'primary_overlay_text_color' ) ), 'section' => $section->id, 'settings' => $customizer->get_setting_name( 'avada_ec_notice_highlight_color', $section ), 'type' => 'hidden', ] ); } /** * Change the map link text. * * @since 5.5.0 * @access public * @param string $link The link markup. * @return string The adapted link markup. */ public function change_map_link_html( $link ) { $link = str_replace( 'target="_blank">+', 'target="_blank">', $link ); return $link; } /** * Style Event Notices. * * @since 5.5.0 * @access public * @param string $html The notice markup. * @param array $notices The actual notices. * @return string The newly styled notice markup. */ public function style_notices( $html, $notices ) { if ( ! empty( $notices ) && shortcode_exists( 'fusion_alert' ) ) { $html = do_shortcode( '[fusion_alert class="tribe-events-notices" type="general"]' . implode( '
', $notices ) . '[/fusion_alert]' ); } return $html; } /** * Positions or disables the events page title. * * @access public * @since 5.6 * @param string $html The template markup. * @param string $template The template. * @param string $file The template file. * @param string $slug The template slug. * @param string $name The template name. * @return string Empty string. */ public function position_events_title_bar( $html, $template, $file, $slug, $name ) { if ( $slug && false !== strpos( $slug, 'title-bar' ) ) { if ( 'disable' === Avada()->settings->get( 'ec_display_page_title' ) ) { return ''; } elseif ( 'below' === Avada()->settings->get( 'ec_display_page_title' ) ) { $this->title_bar_html = str_replace( [ '' ], [ '' ], $html ); $action = 'tribe_events_bar_after_template'; if ( class_exists( 'Tribe__Events__Filterbar__View' ) && 'horizontal' === tribe_get_option( 'events_filters_layout' ) ) { $action = 'tribe_events_filter_view_after_template'; } add_action( $action, [ $this, 'the_events_title_bar' ], 20 ); add_action( 'tribe_events_pro_tribe_events_shortcode_title_bar', [ $this, 'the_events_title_bar' ], 20 ); return ''; } else { // Extend "Upcoming Events" borders on versions above 4.6.18. if ( version_compare( Tribe__Events__Main::VERSION, '4.6.19', '>=' ) ) { $html = str_replace( 'tribe-events-page-title', 'tribe-events-page-title fusion-events-title-above', $html ); } } } return $html; } /** * Echo the events page title bar. * * @access public * @since 5.6 * @param object $class_object A EC Pro shortcode object. * @return void */ public function the_events_title_bar( $class_object = false ) { if ( is_object( $class_object ) ) { if ( ! $class_object->is_attribute_truthy( 'tribe-bar' ) ) { echo $this->title_bar_html; // phpcs:ignore WordPress.Security.EscapeOutput } } else { echo $this->title_bar_html; // phpcs:ignore WordPress.Security.EscapeOutput } } /** * Change headings from h2 to h4. * * @access public * @since 5.6 * @param string $html The template markup. * @param string $template The template. * @param string $file The template file. * @param string $slug The template slug. * @param string $name The template name. * @return string The altered sidebar headings. */ public function sidebar_headings( $html, $template, $file, $slug, $name ) { if ( $slug && false !== strpos( $slug, 'modules/meta/' ) ) { return str_replace( [ '' ], [ '' ], $html ); } return $html; } /** * Adds the social sharing box to single events using blocks. * * @access public * @since 5.9.1 * @param string $content The block contents. * @return string The altered contents. */ public function single_events_blocks_sharing_box( $content ) { if ( tribe( Template_Bootstrap::class )->is_single_event() && has_blocks() && tribe( 'editor' )->is_events_using_blocks() ) { ob_start(); avada_render_social_sharing( 'events' ); $sharing_box = ob_get_clean(); return $content . $sharing_box; } return $content; } /** * Featured image template adjustments to add things like hover effects. * * @access public * @since 6.2 * @param string $html The final HTML. * @param string $file Complete path to include the PHP File. * @param array $name Template name. * @param Tribe__Template $template Current instance of the Tribe__Template. * @return string The adjusted featured image template. */ public function featured_image_template_adjustments( $html, $file, $name, $template ) { return str_replace( 'featured-image-link', 'featured-image-link hover-type-' . Avada()->settings->get( 'ec_hover_type' ), $html ); } /** * Enable the layout builder in the community form. * * @access public * @since 7.3 * @param int $event_id The template ID. * @param object $event The events object. * @param string $template The template file. * @return void */ public function enable_layout_builder( $event_id, $event, $template ) { add_filter( 'the_content', 'do_shortcode', 999 ); } /** * Make sure the correct default template is used if more than one post type is queried. * * @access public * @since 7.9 * @param boolean $use_default Whether we should load the theme templates instead of the Tribe templates. Default false. * @param string $template The template located by WordPress. * @param Tribe__Context $context The singleton, immutable, global object instance. * @param WP_Query $query The global $wp_query, the $wp_the_query if $wp_query empty, null otherwise. From tribe_get_global_query_object() above. * @return boolean */ public function use_wp_template_hierarchy( $use_default, $template, $context, $query ) { if ( is_array( $query->query_vars['post_type'] ) && 1 < count( $query->query_vars['post_type'] ) && in_array( 'tribe_events', $query->query_vars['post_type'], true ) ) { return true; } return $use_default; } /** * Checks if the legacy meta sidebar should be displayed. * * @static * @access public * @since 7.11.10 * @return bool */ public static function has_legacy_meta_sidebar() { if ( is_singular( 'tribe_events' ) && 'sidebar' === fusion_library()->get_option( 'ec_meta_layout' ) && ! ( function_exists( 'Fusion_Template_Builder' ) && Fusion_Template_Builder()->get_override( 'content' ) ) ) { return true; } return false; } /** * Add the single events meta sidebar. * * @access public * @since 7.11.10 * @return void */ public function add_single_events_meta_sidebar() { if ( $this->has_legacy_meta_sidebar() ) { do_action( 'tribe_events_single_event_before_the_meta' ); ob_start(); tribe_get_template_part( 'modules/meta' ); echo apply_filters( 'privacy_iframe_embed', ob_get_clean() ); } } /** * Add the single events sidebar when widgets are disabled. * * @access public * @since 7.11.3 * @return void */ public function add_single_event_sidebar() { if ( '0' === fusion_library()->get_option( 'status_widget_areas' ) && $this->has_legacy_meta_sidebar() ) { add_action( 'avada_after_content', [ $this, 'append_single_event_sidebar' ] ); add_filter( 'awb_content_tag_style', [ $this, 'set_single_event_content_styles' ] ); add_filter( 'awb_aside_1_tag_class', [ $this, 'set_single_event_sidebar_class' ] ); add_filter( 'awb_aside_1_tag_style', [ $this, 'set_single_event_sidebar_styles' ] ); } } /** * Append single sidebar to a page. * * @access public * @since 7.11.3 * @return void */ public function append_single_event_sidebar() { include FUSION_LIBRARY_PATH . '/inc/templates/sidebar-1.php'; } /** * Add the single events content area styles. * * @access public * @since 7.11.3 * @return string */ public function set_single_event_content_styles() { return 'float: left; --sidebar_gutter: 6%'; } /** * Add the single events sidebar area classes. * * @access public * @since 7.11.3 * @return string */ public function set_single_event_sidebar_class() { return 'sidebar fusion-widget-area fusion-content-widget-area fusion-sidebar-right'; } /** * Add the single events sidebar area styles. * * @access public * @since 7.11.3 * @return string */ public function set_single_event_sidebar_styles() { return 'float: right;'; } }