1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* LSX functions and definitions - The Events Calendar. |
4
|
|
|
* |
5
|
|
|
* @package lsx |
6
|
|
|
* @subpackage the-events-calendar |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
10
|
|
|
exit; |
11
|
|
|
} |
12
|
|
|
|
13
|
|
View Code Duplication |
if ( ! function_exists( 'lsx_tec_scripts_add_styles' ) ) : |
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* The Events Calendar enqueue styles. |
17
|
|
|
* |
18
|
|
|
* @package lsx |
19
|
|
|
* @subpackage the-events-calendar |
20
|
|
|
*/ |
21
|
|
|
function lsx_tec_scripts_add_styles() { |
22
|
|
|
wp_enqueue_style( 'the-events-calendar-lsx', get_template_directory_uri() . '/assets/css/the-events-calendar.css', array( 'lsx_main' ), LSX_VERSION ); |
23
|
|
|
wp_style_add_data( 'the-events-calendar-lsx', 'rtl', 'replace' ); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
add_action( 'wp_enqueue_scripts', 'lsx_tec_scripts_add_styles' ); |
27
|
|
|
|
28
|
|
|
endif; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Adds theme stylesheet |
32
|
|
|
* @package lsx |
33
|
|
|
* @subpackage tribe-events |
34
|
|
|
* @category styles |
35
|
|
|
*/ |
36
|
|
|
// function lsx_tribe_breadcrumbs($output) { |
|
|
|
|
37
|
|
|
// global $wp_query; |
38
|
|
|
// if( (isset($wp_query->tribe_is_event) && true === $wp_query->tribe_is_event) || (isset($wp_query->query_vars['post_type']) && !is_array($wp_query->query_vars['post_type']) && 'tribe_venue' === $wp_query->query_vars['post_type'])){ |
39
|
|
|
// if(function_exists('woocommerce_breadcrumb')){ |
40
|
|
|
// $closing_div = '</nav>'; |
41
|
|
|
|
42
|
|
|
// if( is_single()) { |
|
|
|
|
43
|
|
|
// $output = str_replace('Page','<a href="'.get_post_type_archive_link( 'tribe_events' ).'">'.esc_html__('Events','lsx').'</a>',$output); |
44
|
|
|
// if(isset($wp_query->query_vars['eventDisplay']) && 'all' === $wp_query->query_vars['eventDisplay']){ |
45
|
|
|
// $output = str_replace($closing_div,get_the_title($wp_query->query_vars['post_parent']).$closing_div,$output); |
46
|
|
|
// }else{ |
47
|
|
|
// $single_event = get_queried_object(); |
48
|
|
|
// $output = str_replace($closing_div,apply_filters('the_title',$single_event->post_title).$closing_div,$output); |
49
|
|
|
// } |
50
|
|
|
// }elseif( is_tax()) { |
51
|
|
|
// $tax_event = get_queried_object(); |
52
|
|
|
// $output = str_replace('Page','<a href="'.get_post_type_archive_link( 'tribe_events' ).'">'.esc_html__('Events','lsx').'</a>',$output); |
53
|
|
|
// $output = str_replace($closing_div,' / '.apply_filters('the_title',$tax_event->name).$closing_div,$output); |
54
|
|
|
// }else{ |
55
|
|
|
// $output = str_replace('Page',esc_html__('Events','lsx'),$output); |
56
|
|
|
// } |
57
|
|
|
// }elseif(function_exists('yoast_breadcrumb')){ |
58
|
|
|
// $closing_div = '</div>'; |
59
|
|
|
// $last_breadcrumb = '<span class="breadcrumb_last">'.esc_html__('Events','lsx').'</span>'; |
60
|
|
|
|
61
|
|
|
// if( is_single()) { |
|
|
|
|
62
|
|
|
// $single_event = get_queried_object(); |
63
|
|
|
// $output = str_replace($closing_div,'<a href="'.get_post_type_archive_link( 'tribe_events' ).'">'.esc_html__('Events','lsx').'</a> / '.apply_filters('the_title',$single_event->post_title),$output); |
64
|
|
|
// }elseif( is_tax()) { |
65
|
|
|
// $tax_event = get_queried_object(); |
66
|
|
|
// $output = str_replace($last_breadcrumb,'<a href="'.get_post_type_archive_link( 'tribe_events' ).'">'.esc_html__('Events','lsx').'</a> / '.apply_filters('the_title',$tax_event->name),$output); |
67
|
|
|
|
68
|
|
|
// }else{ |
|
|
|
|
69
|
|
|
// $output = str_replace('Page',esc_html__('Events','lsx'),$output); |
70
|
|
|
// } |
71
|
|
|
// } |
72
|
|
|
// } |
73
|
|
|
// return $output; |
74
|
|
|
// } |
75
|
|
|
// add_filter( 'lsx_breadcrumbs', 'lsx_tribe_breadcrumbs',1,10 ); |
76
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.