@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage Gutenberg |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -14,41 +14,41 @@ discard block |
||
| 14 | 14 | * Enqueue Admin styles on admin area |
| 15 | 15 | */ |
| 16 | 16 | function load_gutenberg_admin_style() { |
| 17 | - wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0' ); |
|
| 17 | + wp_enqueue_style('admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0'); |
|
| 18 | 18 | } |
| 19 | -add_action( 'admin_enqueue_scripts', 'load_gutenberg_admin_style' ); |
|
| 19 | +add_action('admin_enqueue_scripts', 'load_gutenberg_admin_style'); |
|
| 20 | 20 | |
| 21 | 21 | // Gutenberg Compatibility. |
| 22 | -require_once( get_template_directory() . '/lib/theme-support.php' ); |
|
| 22 | +require_once(get_template_directory() . '/lib/theme-support.php'); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Add custom class for Gutenberg Compatible template |
| 26 | 26 | */ |
| 27 | -function add_gutenberg_compatible_body_class( $classes ) { |
|
| 27 | +function add_gutenberg_compatible_body_class($classes) { |
|
| 28 | 28 | // if ( ! is_home() && ! is_front_page() ). |
| 29 | - if ( is_page() || is_page_template() || is_single() ) |
|
| 29 | + if (is_page() || is_page_template() || is_single()) |
|
| 30 | 30 | $classes[] = 'gutenberg-compatible-template'; |
| 31 | 31 | |
| 32 | 32 | // Add a class if the page is using the Content and Media block. |
| 33 | 33 | $post = get_post(); |
| 34 | - if ( function_exists( 'has_blocks' ) && isset( $post->post_content ) && has_blocks( $post->post_content ) && ( ! is_search() ) && ( ! is_archive() ) ) { |
|
| 35 | - $blocks = parse_blocks( $post->post_content ); |
|
| 34 | + if (function_exists('has_blocks') && isset($post->post_content) && has_blocks($post->post_content) && ( ! is_search()) && ( ! is_archive())) { |
|
| 35 | + $blocks = parse_blocks($post->post_content); |
|
| 36 | 36 | |
| 37 | - if ( 'core/media-text' === $blocks[0]['blockName'] ) { |
|
| 37 | + if ('core/media-text' === $blocks[0]['blockName']) { |
|
| 38 | 38 | $classes[] = 'has-block-media-text'; |
| 39 | 39 | } |
| 40 | - if ( 'core/cover' === $blocks[0]['blockName'] ) { |
|
| 40 | + if ('core/cover' === $blocks[0]['blockName']) { |
|
| 41 | 41 | $classes[] = 'has-block-cover'; |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | return $classes; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -add_filter( 'body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class' ); |
|
| 47 | +add_filter('body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class'); |
|
| 48 | 48 | |
| 49 | 49 | // Add custom class for templates that are using the Gutenberg editor. |
| 50 | -add_action('body_class', function( $classes ) { |
|
| 51 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) |
|
| 50 | +add_action('body_class', function($classes) { |
|
| 51 | + if (function_exists('has_blocks') && has_blocks(get_the_ID()) && ((is_singular('post') || is_page()))) |
|
| 52 | 52 | $classes[] = 'using-gutenberg'; |
| 53 | 53 | return $classes; |
| 54 | 54 | }); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | * @return void |
| 60 | 60 | */ |
| 61 | 61 | function remove_lsx_page_banner_when_using_blocks() { |
| 62 | - if ( function_exists( 'has_blocks' ) && ( ! class_exists( 'LSX_Banners' ) ) ) { |
|
| 63 | - add_filter( 'lsx_page_banner_disable', '__return_true' ); |
|
| 62 | + if (function_exists('has_blocks') && ( ! class_exists('LSX_Banners'))) { |
|
| 63 | + add_filter('lsx_page_banner_disable', '__return_true'); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | -add_filter( 'init', 'remove_lsx_page_banner_when_using_blocks' ); |
|
| 66 | +add_filter('init', 'remove_lsx_page_banner_when_using_blocks'); |
|
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function add_gutenberg_compatible_body_class( $classes ) { |
| 28 | 28 | // if ( ! is_home() && ! is_front_page() ). |
| 29 | - if ( is_page() || is_page_template() || is_single() ) |
|
| 30 | - $classes[] = 'gutenberg-compatible-template'; |
|
| 29 | + if ( is_page() || is_page_template() || is_single() ) { |
|
| 30 | + $classes[] = 'gutenberg-compatible-template'; |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | // Add a class if the page is using the Content and Media block. |
| 33 | 34 | $post = get_post(); |
@@ -48,8 +49,9 @@ discard block |
||
| 48 | 49 | |
| 49 | 50 | // Add custom class for templates that are using the Gutenberg editor. |
| 50 | 51 | add_action('body_class', function( $classes ) { |
| 51 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) |
|
| 52 | - $classes[] = 'using-gutenberg'; |
|
| 52 | + if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) { |
|
| 53 | + $classes[] = 'using-gutenberg'; |
|
| 54 | + } |
|
| 53 | 55 | return $classes; |
| 54 | 56 | }); |
| 55 | 57 | |
@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage the-events-calendar |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'lsx_tec_scripts_add_styles' ) ) : |
|
| 13 | +if ( ! function_exists('lsx_tec_scripts_add_styles')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * The Events Calendar enqueue styles. |
@@ -22,26 +22,26 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | // Get plugin version. |
| 24 | 24 | $plugin = 'the-events-calendar/the-events-calendar.php'; |
| 25 | - $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
|
| 25 | + $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin); |
|
| 26 | 26 | $version = $data['Version']; |
| 27 | 27 | |
| 28 | - if ( substr( $version, 0, 1 ) >= '5' ) { |
|
| 28 | + if (substr($version, 0, 1) >= '5') { |
|
| 29 | 29 | // New Version 5.0 and up. |
| 30 | - wp_enqueue_style( 'the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar/the-events-calendar-5.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 30 | + wp_enqueue_style('the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar/the-events-calendar-5.css', array('lsx_main'), LSX_VERSION); |
|
| 31 | 31 | } else { |
| 32 | 32 | // Old Version. |
| 33 | - wp_enqueue_style( 'the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar/the-events-calendar.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 33 | + wp_enqueue_style('the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar/the-events-calendar.css', array('lsx_main'), LSX_VERSION); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - wp_enqueue_style( 'the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar/the-events-calendar.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 37 | - wp_style_add_data( 'the-events-calendar-lsx', 'rtl', 'replace' ); |
|
| 36 | + wp_enqueue_style('the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar/the-events-calendar.css', array('lsx_main'), LSX_VERSION); |
|
| 37 | + wp_style_add_data('the-events-calendar-lsx', 'rtl', 'replace'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - add_action( 'wp_enqueue_scripts', 'lsx_tec_scripts_add_styles' ); |
|
| 40 | + add_action('wp_enqueue_scripts', 'lsx_tec_scripts_add_styles'); |
|
| 41 | 41 | |
| 42 | 42 | endif; |
| 43 | 43 | |
| 44 | -if ( ! function_exists( 'lsx_tec_theme_wrapper_start' ) ) : |
|
| 44 | +if ( ! function_exists('lsx_tec_theme_wrapper_start')) : |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * The Events Calendar wrapper start. |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function lsx_tec_theme_wrapper_start() { |
| 53 | 53 | lsx_content_wrap_before(); |
| 54 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
| 54 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
| 55 | 55 | lsx_content_before(); |
| 56 | 56 | echo '<main id="main" class="site-main" role="main">'; |
| 57 | 57 | lsx_content_top(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - add_action( 'tribe_events_before_html', 'lsx_tec_theme_wrapper_start', 9 ); |
|
| 60 | + add_action('tribe_events_before_html', 'lsx_tec_theme_wrapper_start', 9); |
|
| 61 | 61 | |
| 62 | 62 | endif; |
| 63 | 63 | |
| 64 | -if ( ! function_exists( 'lsx_tec_theme_wrapper_end' ) ) : |
|
| 64 | +if ( ! function_exists('lsx_tec_theme_wrapper_end')) : |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * The Events Calendar wrapper end. |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | lsx_content_wrap_after(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - add_action( 'tribe_events_after_html', 'lsx_tec_theme_wrapper_end', 11 ); |
|
| 80 | + add_action('tribe_events_after_html', 'lsx_tec_theme_wrapper_end', 11); |
|
| 81 | 81 | |
| 82 | 82 | endif; |
| 83 | 83 | |
| 84 | -if ( ! function_exists( 'lsx_tec_global_header_title' ) ) : |
|
| 84 | +if ( ! function_exists('lsx_tec_global_header_title')) : |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Move the events title into the global header |
@@ -89,45 +89,45 @@ discard block |
||
| 89 | 89 | * @package lsx |
| 90 | 90 | * @subpackage the-events-calendar |
| 91 | 91 | */ |
| 92 | - function lsx_tec_global_header_title( $title ) { |
|
| 92 | + function lsx_tec_global_header_title($title) { |
|
| 93 | 93 | |
| 94 | - if ( tribe_is_community_edit_event_page() ) { |
|
| 94 | + if (tribe_is_community_edit_event_page()) { |
|
| 95 | 95 | |
| 96 | - $is_route = get_query_var( 'WP_Route' ); |
|
| 97 | - switch ( $is_route ) { |
|
| 96 | + $is_route = get_query_var('WP_Route'); |
|
| 97 | + switch ($is_route) { |
|
| 98 | 98 | case 'ce-edit-route': |
| 99 | - $title = apply_filters( 'tribe_ce_edit_event_page_title', __( 'Edit an Event', 'lsx' ) ); |
|
| 99 | + $title = apply_filters('tribe_ce_edit_event_page_title', __('Edit an Event', 'lsx')); |
|
| 100 | 100 | break; |
| 101 | 101 | |
| 102 | 102 | case 'ce-edit-organizer-route': |
| 103 | - $title = __( 'Edit an Organizer', 'lsx' ); |
|
| 103 | + $title = __('Edit an Organizer', 'lsx'); |
|
| 104 | 104 | break; |
| 105 | 105 | |
| 106 | 106 | case 'ce-edit-venue-route': |
| 107 | - $title = __( 'Edit a Venue', 'lsx' ); |
|
| 107 | + $title = __('Edit a Venue', 'lsx'); |
|
| 108 | 108 | break; |
| 109 | 109 | |
| 110 | 110 | default: |
| 111 | - $title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'Submit an Event', 'lsx' ) ); |
|
| 111 | + $title = apply_filters('tribe_ce_submit_event_page_title', __('Submit an Event', 'lsx')); |
|
| 112 | 112 | break; |
| 113 | 113 | } |
| 114 | - } elseif ( tribe_is_community_my_events_page() ) { |
|
| 115 | - $title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ); |
|
| 116 | - } elseif ( tribe_is_event() ) { |
|
| 114 | + } elseif (tribe_is_community_my_events_page()) { |
|
| 115 | + $title = apply_filters('tribe_ce_submit_event_page_title', __('My Events', 'lsx')); |
|
| 116 | + } elseif (tribe_is_event()) { |
|
| 117 | 117 | $title = tribe_get_events_title(); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Only disable the title after we have retrieved it. |
| 121 | - add_filter( 'tribe_get_events_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
| 121 | + add_filter('tribe_get_events_title', 'lsx_text_disable_body_title', 200, 1); |
|
| 122 | 122 | |
| 123 | - if ( is_singular( 'tribe_events' ) ) { |
|
| 124 | - add_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
| 123 | + if (is_singular('tribe_events')) { |
|
| 124 | + add_filter('the_title', 'lsx_text_disable_body_title', 200, 1); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( class_exists( 'LSX_Banners' ) ) { |
|
| 128 | - if ( is_archive() && is_post_type_archive( 'tribe_events' ) ) { |
|
| 129 | - $options = get_option( '_lsx_settings', false ); |
|
| 130 | - if ( is_array( $options ) && isset( $options['tribe_events'] ) && isset( $options['tribe_events']['title'] ) && '' !== $options['tribe_events']['title'] ) { |
|
| 127 | + if (class_exists('LSX_Banners')) { |
|
| 128 | + if (is_archive() && is_post_type_archive('tribe_events')) { |
|
| 129 | + $options = get_option('_lsx_settings', false); |
|
| 130 | + if (is_array($options) && isset($options['tribe_events']) && isset($options['tribe_events']['title']) && '' !== $options['tribe_events']['title']) { |
|
| 131 | 131 | $title = $options['tribe_events']['title']; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -135,63 +135,63 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | return $title; |
| 137 | 137 | } |
| 138 | - add_filter( 'lsx_banner_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
| 139 | - add_filter( 'lsx_global_header_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
| 138 | + add_filter('lsx_banner_title', 'lsx_tec_global_header_title', 200, 1); |
|
| 139 | + add_filter('lsx_global_header_title', 'lsx_tec_global_header_title', 200, 1); |
|
| 140 | 140 | |
| 141 | 141 | endif; |
| 142 | 142 | |
| 143 | -if ( ! function_exists( 'lsx_text_disable_body_title' ) ) : |
|
| 143 | +if ( ! function_exists('lsx_text_disable_body_title')) : |
|
| 144 | 144 | /** |
| 145 | 145 | * Disable the events title for the post archive if the dynamic setting is active. |
| 146 | 146 | * |
| 147 | 147 | * @param $title |
| 148 | 148 | * @return string |
| 149 | 149 | */ |
| 150 | - function lsx_text_disable_body_title( $title ) { |
|
| 150 | + function lsx_text_disable_body_title($title) { |
|
| 151 | 151 | $title = ''; |
| 152 | - remove_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
| 152 | + remove_filter('the_title', 'lsx_text_disable_body_title', 200, 1); |
|
| 153 | 153 | return $title; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | endif; |
| 157 | 157 | |
| 158 | -if ( ! function_exists( 'lsx_tec_breadcrumb_filter' ) ) : |
|
| 158 | +if ( ! function_exists('lsx_tec_breadcrumb_filter')) : |
|
| 159 | 159 | /** |
| 160 | 160 | * Fixes the community events breadcrumb |
| 161 | 161 | * |
| 162 | 162 | * @package lsx |
| 163 | 163 | * @subpackage the-events-calendar |
| 164 | 164 | */ |
| 165 | - function lsx_tec_breadcrumb_filter( $crumbs ) { |
|
| 165 | + function lsx_tec_breadcrumb_filter($crumbs) { |
|
| 166 | 166 | |
| 167 | - if ( tribe_is_venue() || tribe_is_organizer() || tribe_is_community_edit_event_page() || tribe_is_community_my_events_page() ) { |
|
| 167 | + if (tribe_is_venue() || tribe_is_organizer() || tribe_is_community_edit_event_page() || tribe_is_community_my_events_page()) { |
|
| 168 | 168 | $new_crumbs = array(); |
| 169 | 169 | $new_crumbs[0] = $crumbs[0]; |
| 170 | 170 | |
| 171 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 171 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 172 | 172 | $new_crumbs[1] = array( |
| 173 | - 0 => __( 'Events', 'lsx' ), |
|
| 174 | - 1 => get_post_type_archive_link( 'tribe_events' ), |
|
| 173 | + 0 => __('Events', 'lsx'), |
|
| 174 | + 1 => get_post_type_archive_link('tribe_events'), |
|
| 175 | 175 | ); |
| 176 | 176 | } else { |
| 177 | 177 | $new_crumbs[1] = array( |
| 178 | - 'text' => __( 'Events', 'lsx' ), |
|
| 179 | - 'url' => get_post_type_archive_link( 'tribe_events' ), |
|
| 178 | + 'text' => __('Events', 'lsx'), |
|
| 179 | + 'url' => get_post_type_archive_link('tribe_events'), |
|
| 180 | 180 | ); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ( tribe_is_community_my_events_page() ) { |
|
| 183 | + if (tribe_is_community_my_events_page()) { |
|
| 184 | 184 | $new_crumbs[2] = $crumbs[2]; |
| 185 | - } elseif ( tribe_is_community_edit_event_page() ) { |
|
| 185 | + } elseif (tribe_is_community_edit_event_page()) { |
|
| 186 | 186 | |
| 187 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 187 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 188 | 188 | $new_crumbs[2] = array( |
| 189 | - 0 => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
| 189 | + 0 => apply_filters('tribe_ce_submit_event_page_title', __('My Events', 'lsx')), |
|
| 190 | 190 | 1 => tribe_community_events_list_events_link(), |
| 191 | 191 | ); |
| 192 | 192 | } else { |
| 193 | 193 | $new_crumbs[2] = array( |
| 194 | - 'text' => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
| 194 | + 'text' => apply_filters('tribe_ce_submit_event_page_title', __('My Events', 'lsx')), |
|
| 195 | 195 | 'url' => tribe_community_events_list_events_link(), |
| 196 | 196 | ); |
| 197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | return $crumbs; |
| 206 | 206 | } |
| 207 | - add_filter( 'wpseo_breadcrumb_links', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
| 208 | - add_filter( 'woocommerce_get_breadcrumb', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
| 207 | + add_filter('wpseo_breadcrumb_links', 'lsx_tec_breadcrumb_filter', 30, 1); |
|
| 208 | + add_filter('woocommerce_get_breadcrumb', 'lsx_tec_breadcrumb_filter', 30, 1); |
|
| 209 | 209 | |
| 210 | 210 | endif; |