@@ -7,59 +7,59 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! class_exists( 'LSX_Yoast' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * The LSX Yoast integration class |
|
17 | - */ |
|
18 | - class LSX_Yoast { |
|
15 | + /** |
|
16 | + * The LSX Yoast integration class |
|
17 | + */ |
|
18 | + class LSX_Yoast { |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds class instance |
|
22 | - * |
|
23 | - * @since 1.0.0 |
|
24 | - * @var object |
|
25 | - */ |
|
26 | - protected static $instance = null; |
|
20 | + /** |
|
21 | + * Holds class instance |
|
22 | + * |
|
23 | + * @since 1.0.0 |
|
24 | + * @var object |
|
25 | + */ |
|
26 | + protected static $instance = null; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Setup class. |
|
30 | - * |
|
31 | - * @since 1.0 |
|
32 | - */ |
|
33 | - public function __construct() { |
|
28 | + /** |
|
29 | + * Setup class. |
|
30 | + * |
|
31 | + * @since 1.0 |
|
32 | + */ |
|
33 | + public function __construct() { |
|
34 | 34 | |
35 | - add_action( 'wp_enqueue_scripts', array( $this, 'lsx_yoast_scripts_add_styles' ) ); |
|
36 | - } |
|
35 | + add_action( 'wp_enqueue_scripts', array( $this, 'lsx_yoast_scripts_add_styles' ) ); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Return an instance of this class. |
|
40 | - * |
|
41 | - * @since 1.0.0 |
|
42 | - * @return object A single instance of this class. |
|
43 | - */ |
|
44 | - public static function get_instance() { |
|
45 | - // If the single instance hasn't been set, set it now. |
|
46 | - if ( null === self::$instance ) { |
|
47 | - self::$instance = new self(); |
|
48 | - } |
|
49 | - return self::$instance; |
|
50 | - } |
|
38 | + /** |
|
39 | + * Return an instance of this class. |
|
40 | + * |
|
41 | + * @since 1.0.0 |
|
42 | + * @return object A single instance of this class. |
|
43 | + */ |
|
44 | + public static function get_instance() { |
|
45 | + // If the single instance hasn't been set, set it now. |
|
46 | + if ( null === self::$instance ) { |
|
47 | + self::$instance = new self(); |
|
48 | + } |
|
49 | + return self::$instance; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Yoast enqueue styles. |
|
54 | - * |
|
55 | - * @package lsx |
|
56 | - * @subpackage yoast |
|
57 | - */ |
|
58 | - public function lsx_yoast_scripts_add_styles() { |
|
59 | - wp_enqueue_script( 'lsx_yoast_js', get_template_directory_uri() . '/assets/js/yoast/yoast.js', array( 'jquery' ), LSX_VERSION, true ); |
|
60 | - wp_enqueue_style( 'lsx_yoast_css', get_template_directory_uri() . '/assets/css/yoast/yoast.css', array( 'lsx_main' ), LSX_VERSION ); |
|
61 | - } |
|
62 | - } |
|
52 | + /** |
|
53 | + * Yoast enqueue styles. |
|
54 | + * |
|
55 | + * @package lsx |
|
56 | + * @subpackage yoast |
|
57 | + */ |
|
58 | + public function lsx_yoast_scripts_add_styles() { |
|
59 | + wp_enqueue_script( 'lsx_yoast_js', get_template_directory_uri() . '/assets/js/yoast/yoast.js', array( 'jquery' ), LSX_VERSION, true ); |
|
60 | + wp_enqueue_style( 'lsx_yoast_css', get_template_directory_uri() . '/assets/css/yoast/yoast.css', array( 'lsx_main' ), LSX_VERSION ); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | endif; |
65 | 65 |
@@ -7,210 +7,210 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_tec_scripts_add_styles' ) ) : |
14 | 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 | - |
|
23 | - // Get plugin version. |
|
24 | - $plugin = 'the-events-calendar/the-events-calendar.php'; |
|
25 | - $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
|
26 | - $version = $data['Version']; |
|
27 | - |
|
28 | - if ( substr( $version, 0, 1 ) >= '5' ) { |
|
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 ); |
|
31 | - } else { |
|
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 ); |
|
34 | - } |
|
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' ); |
|
38 | - } |
|
39 | - |
|
40 | - add_action( 'wp_enqueue_scripts', 'lsx_tec_scripts_add_styles' ); |
|
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 | + |
|
23 | + // Get plugin version. |
|
24 | + $plugin = 'the-events-calendar/the-events-calendar.php'; |
|
25 | + $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
|
26 | + $version = $data['Version']; |
|
27 | + |
|
28 | + if ( substr( $version, 0, 1 ) >= '5' ) { |
|
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 ); |
|
31 | + } else { |
|
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 ); |
|
34 | + } |
|
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' ); |
|
38 | + } |
|
39 | + |
|
40 | + add_action( 'wp_enqueue_scripts', 'lsx_tec_scripts_add_styles' ); |
|
41 | 41 | |
42 | 42 | endif; |
43 | 43 | |
44 | 44 | if ( ! function_exists( 'lsx_tec_theme_wrapper_start' ) ) : |
45 | 45 | |
46 | - /** |
|
47 | - * The Events Calendar wrapper start. |
|
48 | - * |
|
49 | - * @package lsx |
|
50 | - * @subpackage the-events-calendar |
|
51 | - */ |
|
52 | - function lsx_tec_theme_wrapper_start() { |
|
53 | - if ( function_exists( 'lsx_is_rest_api_request' ) && lsx_is_rest_api_request() ) { |
|
54 | - return; |
|
55 | - } |
|
56 | - lsx_content_wrap_before(); |
|
57 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
58 | - lsx_content_before(); |
|
59 | - echo '<main id="main" class="site-main" role="main">'; |
|
60 | - lsx_content_top(); |
|
61 | - } |
|
62 | - |
|
63 | - add_action( 'tribe_events_before_html', 'lsx_tec_theme_wrapper_start', 9 ); |
|
46 | + /** |
|
47 | + * The Events Calendar wrapper start. |
|
48 | + * |
|
49 | + * @package lsx |
|
50 | + * @subpackage the-events-calendar |
|
51 | + */ |
|
52 | + function lsx_tec_theme_wrapper_start() { |
|
53 | + if ( function_exists( 'lsx_is_rest_api_request' ) && lsx_is_rest_api_request() ) { |
|
54 | + return; |
|
55 | + } |
|
56 | + lsx_content_wrap_before(); |
|
57 | + echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
58 | + lsx_content_before(); |
|
59 | + echo '<main id="main" class="site-main" role="main">'; |
|
60 | + lsx_content_top(); |
|
61 | + } |
|
62 | + |
|
63 | + add_action( 'tribe_events_before_html', 'lsx_tec_theme_wrapper_start', 9 ); |
|
64 | 64 | |
65 | 65 | endif; |
66 | 66 | |
67 | 67 | if ( ! function_exists( 'lsx_tec_theme_wrapper_end' ) ) : |
68 | 68 | |
69 | - /** |
|
70 | - * The Events Calendar wrapper end. |
|
71 | - * |
|
72 | - * @package lsx |
|
73 | - * @subpackage the-events-calendar |
|
74 | - */ |
|
75 | - function lsx_tec_theme_wrapper_end() { |
|
76 | - if ( function_exists( 'lsx_is_rest_api_request' ) && lsx_is_rest_api_request() ) { |
|
77 | - return; |
|
78 | - } |
|
79 | - lsx_content_bottom(); |
|
80 | - echo '</main>'; |
|
81 | - lsx_content_after(); |
|
82 | - echo '</div>'; |
|
83 | - lsx_content_wrap_after(); |
|
84 | - } |
|
85 | - |
|
86 | - add_action( 'tribe_events_after_html', 'lsx_tec_theme_wrapper_end', 11 ); |
|
69 | + /** |
|
70 | + * The Events Calendar wrapper end. |
|
71 | + * |
|
72 | + * @package lsx |
|
73 | + * @subpackage the-events-calendar |
|
74 | + */ |
|
75 | + function lsx_tec_theme_wrapper_end() { |
|
76 | + if ( function_exists( 'lsx_is_rest_api_request' ) && lsx_is_rest_api_request() ) { |
|
77 | + return; |
|
78 | + } |
|
79 | + lsx_content_bottom(); |
|
80 | + echo '</main>'; |
|
81 | + lsx_content_after(); |
|
82 | + echo '</div>'; |
|
83 | + lsx_content_wrap_after(); |
|
84 | + } |
|
85 | + |
|
86 | + add_action( 'tribe_events_after_html', 'lsx_tec_theme_wrapper_end', 11 ); |
|
87 | 87 | |
88 | 88 | endif; |
89 | 89 | |
90 | 90 | if ( ! function_exists( 'lsx_tec_global_header_title' ) ) : |
91 | 91 | |
92 | - /** |
|
93 | - * Move the events title into the global header |
|
94 | - * |
|
95 | - * @package lsx |
|
96 | - * @subpackage the-events-calendar |
|
97 | - */ |
|
98 | - function lsx_tec_global_header_title( $title ) { |
|
99 | - |
|
100 | - if ( tribe_is_community_edit_event_page() ) { |
|
101 | - |
|
102 | - $is_route = get_query_var( 'WP_Route' ); |
|
103 | - switch ( $is_route ) { |
|
104 | - case 'ce-edit-route': |
|
105 | - $title = apply_filters( 'tribe_ce_edit_event_page_title', __( 'Edit an Event', 'lsx' ) ); |
|
106 | - break; |
|
107 | - |
|
108 | - case 'ce-edit-organizer-route': |
|
109 | - $title = __( 'Edit an Organizer', 'lsx' ); |
|
110 | - break; |
|
111 | - |
|
112 | - case 'ce-edit-venue-route': |
|
113 | - $title = __( 'Edit a Venue', 'lsx' ); |
|
114 | - break; |
|
115 | - |
|
116 | - default: |
|
117 | - $title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'Submit an Event', 'lsx' ) ); |
|
118 | - break; |
|
119 | - } |
|
120 | - } elseif ( tribe_is_community_my_events_page() ) { |
|
121 | - $title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ); |
|
122 | - } elseif ( tribe_is_event() ) { |
|
123 | - $title = tribe_get_events_title(); |
|
124 | - } |
|
125 | - |
|
126 | - // Only disable the title after we have retrieved it. |
|
127 | - add_filter( 'tribe_get_events_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
128 | - |
|
129 | - if ( is_singular( 'tribe_events' ) ) { |
|
130 | - add_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
131 | - } |
|
132 | - |
|
133 | - if ( class_exists( 'LSX_Banners' ) ) { |
|
134 | - if ( is_archive() && is_post_type_archive( 'tribe_events' ) ) { |
|
135 | - $options = get_option( '_lsx_settings', false ); |
|
136 | - if ( is_array( $options ) && isset( $options['tribe_events'] ) && isset( $options['tribe_events']['title'] ) && '' !== $options['tribe_events']['title'] ) { |
|
137 | - $title = $options['tribe_events']['title']; |
|
138 | - } |
|
139 | - } |
|
140 | - $title = '<h1 class="page-title">' . $title . '</h1>'; |
|
141 | - } |
|
142 | - return $title; |
|
143 | - } |
|
144 | - add_filter( 'lsx_banner_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
145 | - add_filter( 'lsx_global_header_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
92 | + /** |
|
93 | + * Move the events title into the global header |
|
94 | + * |
|
95 | + * @package lsx |
|
96 | + * @subpackage the-events-calendar |
|
97 | + */ |
|
98 | + function lsx_tec_global_header_title( $title ) { |
|
99 | + |
|
100 | + if ( tribe_is_community_edit_event_page() ) { |
|
101 | + |
|
102 | + $is_route = get_query_var( 'WP_Route' ); |
|
103 | + switch ( $is_route ) { |
|
104 | + case 'ce-edit-route': |
|
105 | + $title = apply_filters( 'tribe_ce_edit_event_page_title', __( 'Edit an Event', 'lsx' ) ); |
|
106 | + break; |
|
107 | + |
|
108 | + case 'ce-edit-organizer-route': |
|
109 | + $title = __( 'Edit an Organizer', 'lsx' ); |
|
110 | + break; |
|
111 | + |
|
112 | + case 'ce-edit-venue-route': |
|
113 | + $title = __( 'Edit a Venue', 'lsx' ); |
|
114 | + break; |
|
115 | + |
|
116 | + default: |
|
117 | + $title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'Submit an Event', 'lsx' ) ); |
|
118 | + break; |
|
119 | + } |
|
120 | + } elseif ( tribe_is_community_my_events_page() ) { |
|
121 | + $title = apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ); |
|
122 | + } elseif ( tribe_is_event() ) { |
|
123 | + $title = tribe_get_events_title(); |
|
124 | + } |
|
125 | + |
|
126 | + // Only disable the title after we have retrieved it. |
|
127 | + add_filter( 'tribe_get_events_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
128 | + |
|
129 | + if ( is_singular( 'tribe_events' ) ) { |
|
130 | + add_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
131 | + } |
|
132 | + |
|
133 | + if ( class_exists( 'LSX_Banners' ) ) { |
|
134 | + if ( is_archive() && is_post_type_archive( 'tribe_events' ) ) { |
|
135 | + $options = get_option( '_lsx_settings', false ); |
|
136 | + if ( is_array( $options ) && isset( $options['tribe_events'] ) && isset( $options['tribe_events']['title'] ) && '' !== $options['tribe_events']['title'] ) { |
|
137 | + $title = $options['tribe_events']['title']; |
|
138 | + } |
|
139 | + } |
|
140 | + $title = '<h1 class="page-title">' . $title . '</h1>'; |
|
141 | + } |
|
142 | + return $title; |
|
143 | + } |
|
144 | + add_filter( 'lsx_banner_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
145 | + add_filter( 'lsx_global_header_title', 'lsx_tec_global_header_title', 200, 1 ); |
|
146 | 146 | |
147 | 147 | endif; |
148 | 148 | |
149 | 149 | if ( ! function_exists( 'lsx_text_disable_body_title' ) ) : |
150 | - /** |
|
151 | - * Disable the events title for the post archive if the dynamic setting is active. |
|
152 | - * |
|
153 | - * @param $title |
|
154 | - * @return string |
|
155 | - */ |
|
156 | - function lsx_text_disable_body_title( $title ) { |
|
157 | - $title = ''; |
|
158 | - remove_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
159 | - return $title; |
|
160 | - } |
|
150 | + /** |
|
151 | + * Disable the events title for the post archive if the dynamic setting is active. |
|
152 | + * |
|
153 | + * @param $title |
|
154 | + * @return string |
|
155 | + */ |
|
156 | + function lsx_text_disable_body_title( $title ) { |
|
157 | + $title = ''; |
|
158 | + remove_filter( 'the_title', 'lsx_text_disable_body_title', 200, 1 ); |
|
159 | + return $title; |
|
160 | + } |
|
161 | 161 | |
162 | 162 | endif; |
163 | 163 | |
164 | 164 | if ( ! function_exists( 'lsx_tec_breadcrumb_filter' ) ) : |
165 | - /** |
|
166 | - * Fixes the community events breadcrumb |
|
167 | - * |
|
168 | - * @package lsx |
|
169 | - * @subpackage the-events-calendar |
|
170 | - */ |
|
171 | - function lsx_tec_breadcrumb_filter( $crumbs ) { |
|
172 | - |
|
173 | - if ( tribe_is_venue() || tribe_is_organizer() || tribe_is_community_edit_event_page() || tribe_is_community_my_events_page() ) { |
|
174 | - $new_crumbs = array(); |
|
175 | - $new_crumbs[0] = $crumbs[0]; |
|
176 | - |
|
177 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
178 | - $new_crumbs[1] = array( |
|
179 | - 0 => __( 'Events', 'lsx' ), |
|
180 | - 1 => get_post_type_archive_link( 'tribe_events' ), |
|
181 | - ); |
|
182 | - } else { |
|
183 | - $new_crumbs[1] = array( |
|
184 | - 'text' => __( 'Events', 'lsx' ), |
|
185 | - 'url' => get_post_type_archive_link( 'tribe_events' ), |
|
186 | - ); |
|
187 | - } |
|
188 | - |
|
189 | - if ( tribe_is_community_my_events_page() ) { |
|
190 | - $new_crumbs[2] = $crumbs[2]; |
|
191 | - } elseif ( tribe_is_community_edit_event_page() ) { |
|
192 | - |
|
193 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
194 | - $new_crumbs[2] = array( |
|
195 | - 0 => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
196 | - 1 => tribe_community_events_list_events_link(), |
|
197 | - ); |
|
198 | - } else { |
|
199 | - $new_crumbs[2] = array( |
|
200 | - 'text' => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
201 | - 'url' => tribe_community_events_list_events_link(), |
|
202 | - ); |
|
203 | - } |
|
204 | - |
|
205 | - $new_crumbs[3] = $crumbs[2]; |
|
206 | - } else { |
|
207 | - $new_crumbs[2] = $crumbs[1]; |
|
208 | - } |
|
209 | - $crumbs = $new_crumbs; |
|
210 | - } |
|
211 | - return $crumbs; |
|
212 | - } |
|
213 | - add_filter( 'wpseo_breadcrumb_links', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
214 | - add_filter( 'woocommerce_get_breadcrumb', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
165 | + /** |
|
166 | + * Fixes the community events breadcrumb |
|
167 | + * |
|
168 | + * @package lsx |
|
169 | + * @subpackage the-events-calendar |
|
170 | + */ |
|
171 | + function lsx_tec_breadcrumb_filter( $crumbs ) { |
|
172 | + |
|
173 | + if ( tribe_is_venue() || tribe_is_organizer() || tribe_is_community_edit_event_page() || tribe_is_community_my_events_page() ) { |
|
174 | + $new_crumbs = array(); |
|
175 | + $new_crumbs[0] = $crumbs[0]; |
|
176 | + |
|
177 | + if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
178 | + $new_crumbs[1] = array( |
|
179 | + 0 => __( 'Events', 'lsx' ), |
|
180 | + 1 => get_post_type_archive_link( 'tribe_events' ), |
|
181 | + ); |
|
182 | + } else { |
|
183 | + $new_crumbs[1] = array( |
|
184 | + 'text' => __( 'Events', 'lsx' ), |
|
185 | + 'url' => get_post_type_archive_link( 'tribe_events' ), |
|
186 | + ); |
|
187 | + } |
|
188 | + |
|
189 | + if ( tribe_is_community_my_events_page() ) { |
|
190 | + $new_crumbs[2] = $crumbs[2]; |
|
191 | + } elseif ( tribe_is_community_edit_event_page() ) { |
|
192 | + |
|
193 | + if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
194 | + $new_crumbs[2] = array( |
|
195 | + 0 => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
196 | + 1 => tribe_community_events_list_events_link(), |
|
197 | + ); |
|
198 | + } else { |
|
199 | + $new_crumbs[2] = array( |
|
200 | + 'text' => apply_filters( 'tribe_ce_submit_event_page_title', __( 'My Events', 'lsx' ) ), |
|
201 | + 'url' => tribe_community_events_list_events_link(), |
|
202 | + ); |
|
203 | + } |
|
204 | + |
|
205 | + $new_crumbs[3] = $crumbs[2]; |
|
206 | + } else { |
|
207 | + $new_crumbs[2] = $crumbs[1]; |
|
208 | + } |
|
209 | + $crumbs = $new_crumbs; |
|
210 | + } |
|
211 | + return $crumbs; |
|
212 | + } |
|
213 | + add_filter( 'wpseo_breadcrumb_links', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
214 | + add_filter( 'woocommerce_get_breadcrumb', 'lsx_tec_breadcrumb_filter', 30, 1 ); |
|
215 | 215 | |
216 | 216 | endif; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * This is the 1st action in the theme that fires after <head>. |
15 | 15 | */ |
16 | 16 | function lsx_head_top() { |
17 | - do_action( 'lsx_head_top' ); |
|
17 | + do_action( 'lsx_head_top' ); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function lsx_head_bottom() { |
26 | - do_action( 'lsx_head_bottom' ); |
|
26 | + do_action( 'lsx_head_bottom' ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * The 3rd action thta fires after <body> |
31 | 31 | */ |
32 | 32 | function lsx_body_top() { |
33 | - do_action( 'lsx_body_top' ); |
|
33 | + do_action( 'lsx_body_top' ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * $lsx_supports[] = 'header'; |
40 | 40 | */ |
41 | 41 | function lsx_header_before() { |
42 | - do_action( 'lsx_header_before' ); |
|
42 | + do_action( 'lsx_header_before' ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | function lsx_header_top() { |
51 | - do_action( 'lsx_header_top' ); |
|
51 | + do_action( 'lsx_header_top' ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return void |
58 | 58 | */ |
59 | 59 | function lsx_nav_before() { |
60 | - do_action( 'lsx_nav_before' ); |
|
60 | + do_action( 'lsx_nav_before' ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function lsx_nav_after() { |
69 | - do_action( 'lsx_nav_after' ); |
|
69 | + do_action( 'lsx_nav_after' ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return void |
76 | 76 | */ |
77 | 77 | function lsx_header_bottom() { |
78 | - do_action( 'lsx_header_bottom' ); |
|
78 | + do_action( 'lsx_header_bottom' ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return void |
85 | 85 | */ |
86 | 86 | function lsx_header_after() { |
87 | - do_action( 'lsx_header_after' ); |
|
87 | + do_action( 'lsx_header_after' ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | function lsx_header_wrap_after() { |
96 | - do_action( 'lsx_header_wrap_after' ); |
|
96 | + do_action( 'lsx_header_wrap_after' ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return void |
103 | 103 | */ |
104 | 104 | function lsx_header_wrap_container_top() { |
105 | - do_action( 'lsx_header_wrap_container_top' ); |
|
105 | + do_action( 'lsx_header_wrap_container_top' ); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return void |
112 | 112 | */ |
113 | 113 | function lsx_body_bottom() { |
114 | - do_action( 'lsx_body_bottom' ); |
|
114 | + do_action( 'lsx_body_bottom' ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * $lsx_supports[] = 'banner'; |
121 | 121 | */ |
122 | 122 | function lsx_banner_content() { |
123 | - do_action( 'lsx_banner_content' ); |
|
123 | + do_action( 'lsx_banner_content' ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | function lsx_banner_inner_top() { |
132 | - do_action( 'lsx_banner_inner_top' ); |
|
132 | + do_action( 'lsx_banner_inner_top' ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return void |
139 | 139 | */ |
140 | 140 | function lsx_banner_inner_bottom() { |
141 | - do_action( 'lsx_banner_inner_bottom' ); |
|
141 | + do_action( 'lsx_banner_inner_bottom' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * $lsx_supports[] = 'global_header'; |
148 | 148 | */ |
149 | 149 | function lsx_global_header_inner_bottom() { |
150 | - do_action( 'lsx_global_header_inner_bottom' ); |
|
150 | + do_action( 'lsx_global_header_inner_bottom' ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * $lsx_supports[] = 'content'; |
157 | 157 | */ |
158 | 158 | function lsx_content_wrap_before() { |
159 | - do_action( 'lsx_content_wrap_before' ); |
|
159 | + do_action( 'lsx_content_wrap_before' ); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return void |
166 | 166 | */ |
167 | 167 | function lsx_content_wrap_after() { |
168 | - do_action( 'lsx_content_wrap_after' ); |
|
168 | + do_action( 'lsx_content_wrap_after' ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return void |
175 | 175 | */ |
176 | 176 | function lsx_content_before() { |
177 | - do_action( 'lsx_content_before' ); |
|
177 | + do_action( 'lsx_content_before' ); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function lsx_content_after() { |
186 | - do_action( 'lsx_content_after' ); |
|
186 | + do_action( 'lsx_content_after' ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return void |
193 | 193 | */ |
194 | 194 | function lsx_content_top() { |
195 | - do_action( 'lsx_content_top' ); |
|
195 | + do_action( 'lsx_content_top' ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @return void |
202 | 202 | */ |
203 | 203 | function lsx_content_bottom() { |
204 | - do_action( 'lsx_content_bottom' ); |
|
204 | + do_action( 'lsx_content_bottom' ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return void |
211 | 211 | */ |
212 | 212 | function lsx_content_post_tags() { |
213 | - do_action( 'lsx_content_post_tags' ); |
|
213 | + do_action( 'lsx_content_post_tags' ); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return void |
220 | 220 | */ |
221 | 221 | function lsx_content_sharing() { |
222 | - do_action( 'lsx_content_sharing' ); |
|
222 | + do_action( 'lsx_content_sharing' ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * $lsx_supports[] = 'entry'; |
229 | 229 | */ |
230 | 230 | function lsx_entry_before() { |
231 | - do_action( 'lsx_entry_before' ); |
|
231 | + do_action( 'lsx_entry_before' ); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return void |
238 | 238 | */ |
239 | 239 | function lsx_entry_after() { |
240 | - do_action( 'lsx_entry_after' ); |
|
240 | + do_action( 'lsx_entry_after' ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @return void |
247 | 247 | */ |
248 | 248 | function lsx_entry_top() { |
249 | - do_action( 'lsx_entry_top' ); |
|
249 | + do_action( 'lsx_entry_top' ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return void |
256 | 256 | */ |
257 | 257 | function lsx_entry_inside_top() { |
258 | - do_action( 'lsx_entry_inside_top' ); |
|
258 | + do_action( 'lsx_entry_inside_top' ); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * @return void |
265 | 265 | */ |
266 | 266 | function lsx_entry_bottom() { |
267 | - do_action( 'lsx_entry_bottom' ); |
|
267 | + do_action( 'lsx_entry_bottom' ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Semantic <entry> hooks |
272 | 272 | */ |
273 | 273 | function lsx_post_meta_top() { |
274 | - do_action( 'lsx_post_meta_top' ); |
|
274 | + do_action( 'lsx_post_meta_top' ); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * $lsx_supports[] = 'entry'; |
281 | 281 | */ |
282 | 282 | function lsx_widget_entry_before() { |
283 | - do_action( 'lsx_widget_entry_before' ); |
|
283 | + do_action( 'lsx_widget_entry_before' ); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @return void |
290 | 290 | */ |
291 | 291 | function lsx_widget_entry_after() { |
292 | - do_action( 'lsx_widget_entry_after' ); |
|
292 | + do_action( 'lsx_widget_entry_after' ); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @return void |
299 | 299 | */ |
300 | 300 | function lsx_widget_entry_top() { |
301 | - do_action( 'lsx_widget_entry_top' ); |
|
301 | + do_action( 'lsx_widget_entry_top' ); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return void |
308 | 308 | */ |
309 | 309 | function lsx_widget_entry_bottom() { |
310 | - do_action( 'lsx_widget_entry_bottom' ); |
|
310 | + do_action( 'lsx_widget_entry_bottom' ); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @return void |
317 | 317 | */ |
318 | 318 | function lsx_widget_entry_content_top() { |
319 | - do_action( 'lsx_widget_entry_content_top' ); |
|
319 | + do_action( 'lsx_widget_entry_content_top' ); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @return void |
326 | 326 | */ |
327 | 327 | function lsx_widget_entry_content_bottom() { |
328 | - do_action( 'lsx_widget_entry_content_bottom' ); |
|
328 | + do_action( 'lsx_widget_entry_content_bottom' ); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * $lsx_supports[] = 'comments'; |
335 | 335 | */ |
336 | 336 | function lsx_comments_before() { |
337 | - do_action( 'lsx_comments_before' ); |
|
337 | + do_action( 'lsx_comments_before' ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | */ |
345 | 345 | function lsx_comments_after() { |
346 | - do_action( 'lsx_comments_after' ); |
|
346 | + do_action( 'lsx_comments_after' ); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * $lsx_supports[] = 'sidebar'; |
353 | 353 | */ |
354 | 354 | function lsx_sidebars_before() { |
355 | - do_action( 'lsx_sidebars_before' ); |
|
355 | + do_action( 'lsx_sidebars_before' ); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @return void |
362 | 362 | */ |
363 | 363 | function lsx_sidebars_after() { |
364 | - do_action( 'lsx_sidebars_after' ); |
|
364 | + do_action( 'lsx_sidebars_after' ); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | * @return void |
371 | 371 | */ |
372 | 372 | function lsx_sidebar_top() { |
373 | - do_action( 'lsx_sidebar_top' ); |
|
373 | + do_action( 'lsx_sidebar_top' ); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @return void |
380 | 380 | */ |
381 | 381 | function lsx_sidebar_bottom() { |
382 | - do_action( 'lsx_sidebar_bottom' ); |
|
382 | + do_action( 'lsx_sidebar_bottom' ); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * $lsx_supports[] = 'footer'; |
389 | 389 | */ |
390 | 390 | function lsx_footer_before() { |
391 | - do_action( 'lsx_footer_before' ); |
|
391 | + do_action( 'lsx_footer_before' ); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @return void |
398 | 398 | */ |
399 | 399 | function lsx_footer_after() { |
400 | - do_action( 'lsx_footer_after' ); |
|
400 | + do_action( 'lsx_footer_after' ); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @return void |
407 | 407 | */ |
408 | 408 | function lsx_footer_top() { |
409 | - do_action( 'lsx_footer_top' ); |
|
409 | + do_action( 'lsx_footer_top' ); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -415,5 +415,5 @@ discard block |
||
415 | 415 | * @return void |
416 | 416 | */ |
417 | 417 | function lsx_footer_bottom() { |
418 | - do_action( 'lsx_footer_bottom' ); |
|
418 | + do_action( 'lsx_footer_bottom' ); |
|
419 | 419 | } |
@@ -7,273 +7,273 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_setup' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * Theme after_setup_theme action. |
|
17 | - * |
|
18 | - * @package lsx |
|
19 | - * @subpackage config |
|
20 | - */ |
|
21 | - function lsx_setup() { |
|
22 | - global $content_width; |
|
23 | - $content_width = 1140; |
|
24 | - |
|
25 | - load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
26 | - |
|
27 | - add_image_size( 'lsx-thumbnail-carousel', 350, 230, true ); |
|
28 | - add_image_size( 'lsx-thumbnail-wide', 360, 168, true ); |
|
29 | - add_image_size( 'lsx-thumbnail-square', 350, 350, true ); |
|
30 | - add_image_size( 'lsx-thumbnail-single', 750, 350, true ); |
|
31 | - add_image_size( 'lsx-banner', 1920, 600, true ); |
|
32 | - |
|
33 | - register_nav_menus( |
|
34 | - array( |
|
35 | - 'primary' => esc_html__( 'Primary Menu', 'lsx' ), |
|
36 | - 'top-menu' => esc_html__( 'Top Menu (right)', 'lsx' ), |
|
37 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx' ), |
|
38 | - 'social' => esc_html__( 'Social Menu', 'lsx' ), |
|
39 | - 'footer' => esc_html__( 'Footer Menu', 'lsx' ), |
|
40 | - ) |
|
41 | - ); |
|
42 | - |
|
43 | - add_theme_support( 'automatic-feed-links' ); |
|
44 | - add_theme_support( 'custom-background' ); |
|
45 | - |
|
46 | - add_theme_support( |
|
47 | - 'custom-logo', |
|
48 | - array( |
|
49 | - 'height' => 50, |
|
50 | - 'width' => 160, |
|
51 | - 'flex-width' => true, |
|
52 | - 'flex-height' => true, |
|
53 | - ) |
|
54 | - ); |
|
55 | - |
|
56 | - add_theme_support( 'html5', array( 'caption' ) ); |
|
57 | - |
|
58 | - add_theme_support( |
|
59 | - 'post-formats', |
|
60 | - array( |
|
61 | - 'image', |
|
62 | - 'video', |
|
63 | - 'gallery', |
|
64 | - 'audio', |
|
65 | - 'quote', |
|
66 | - ) |
|
67 | - ); |
|
68 | - |
|
69 | - add_theme_support( 'post-thumbnails' ); |
|
70 | - add_theme_support( 'sensei' ); |
|
71 | - |
|
72 | - add_theme_support( |
|
73 | - 'site-logo', |
|
74 | - array( |
|
75 | - 'header-text' => array( |
|
76 | - 'site-title', |
|
77 | - 'site-description', |
|
78 | - ), |
|
79 | - 'size' => 'medium', |
|
80 | - ) |
|
81 | - ); |
|
82 | - |
|
83 | - add_theme_support( 'title-tag' ); |
|
84 | - |
|
85 | - /* |
|
15 | + /** |
|
16 | + * Theme after_setup_theme action. |
|
17 | + * |
|
18 | + * @package lsx |
|
19 | + * @subpackage config |
|
20 | + */ |
|
21 | + function lsx_setup() { |
|
22 | + global $content_width; |
|
23 | + $content_width = 1140; |
|
24 | + |
|
25 | + load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
26 | + |
|
27 | + add_image_size( 'lsx-thumbnail-carousel', 350, 230, true ); |
|
28 | + add_image_size( 'lsx-thumbnail-wide', 360, 168, true ); |
|
29 | + add_image_size( 'lsx-thumbnail-square', 350, 350, true ); |
|
30 | + add_image_size( 'lsx-thumbnail-single', 750, 350, true ); |
|
31 | + add_image_size( 'lsx-banner', 1920, 600, true ); |
|
32 | + |
|
33 | + register_nav_menus( |
|
34 | + array( |
|
35 | + 'primary' => esc_html__( 'Primary Menu', 'lsx' ), |
|
36 | + 'top-menu' => esc_html__( 'Top Menu (right)', 'lsx' ), |
|
37 | + 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx' ), |
|
38 | + 'social' => esc_html__( 'Social Menu', 'lsx' ), |
|
39 | + 'footer' => esc_html__( 'Footer Menu', 'lsx' ), |
|
40 | + ) |
|
41 | + ); |
|
42 | + |
|
43 | + add_theme_support( 'automatic-feed-links' ); |
|
44 | + add_theme_support( 'custom-background' ); |
|
45 | + |
|
46 | + add_theme_support( |
|
47 | + 'custom-logo', |
|
48 | + array( |
|
49 | + 'height' => 50, |
|
50 | + 'width' => 160, |
|
51 | + 'flex-width' => true, |
|
52 | + 'flex-height' => true, |
|
53 | + ) |
|
54 | + ); |
|
55 | + |
|
56 | + add_theme_support( 'html5', array( 'caption' ) ); |
|
57 | + |
|
58 | + add_theme_support( |
|
59 | + 'post-formats', |
|
60 | + array( |
|
61 | + 'image', |
|
62 | + 'video', |
|
63 | + 'gallery', |
|
64 | + 'audio', |
|
65 | + 'quote', |
|
66 | + ) |
|
67 | + ); |
|
68 | + |
|
69 | + add_theme_support( 'post-thumbnails' ); |
|
70 | + add_theme_support( 'sensei' ); |
|
71 | + |
|
72 | + add_theme_support( |
|
73 | + 'site-logo', |
|
74 | + array( |
|
75 | + 'header-text' => array( |
|
76 | + 'site-title', |
|
77 | + 'site-description', |
|
78 | + ), |
|
79 | + 'size' => 'medium', |
|
80 | + ) |
|
81 | + ); |
|
82 | + |
|
83 | + add_theme_support( 'title-tag' ); |
|
84 | + |
|
85 | + /* |
|
86 | 86 | * @TODO - Necessary to test it |
87 | 87 | */ |
88 | 88 | |
89 | - // add_theme_support( 'woocommerce' );. |
|
90 | - add_theme_support( 'starter-content', array( |
|
91 | - 'widgets' => array( |
|
92 | - 'sidebar-home' => array( |
|
93 | - 'custom_widget_1' => array( |
|
94 | - 'text', |
|
95 | - |
|
96 | - array( |
|
97 | - 'title' => '', |
|
98 | - 'text' => wp_kses_post( '<div class="row"><div class="col-sm-12 text-center"><h3>Build your perfect website <small>with the LSX theme</small></h3></div></div><div class="row"><div class="col-sm-4 text-center"><h4>Fast</h4><p>"Quick" isn\'t a word most people use when describing their website building experience.</p></div><div class="col-sm-4 text-center"><h4>Easy</h4><p>We\'ve built websites for countless clients, and we know what kind of back-end makes sense easily.</p></div><div class="col-sm-4 text-center"><h4>Comprehensive</h4><p>The LSX extensions come with features out the box that are essential.</p></div></div>' ), |
|
99 | - ), |
|
100 | - ), |
|
101 | - |
|
102 | - 'custom_widget_2' => array( |
|
103 | - 'text', |
|
104 | - |
|
105 | - array( |
|
106 | - 'title' => '', |
|
107 | - 'text' => wp_kses_post( '<div class="lsx-full-width-alt"><div class="row"><div class="col-xs-12"><h3>A big CTA title</h3><p class="text-center"><a class="btn cta-btn" href="http://www.lsdeb.biz/" target="_blank" rel="noreferrer noopener">Hire Us</a><p></div></div></div>' ), |
|
108 | - ), |
|
109 | - ), |
|
110 | - |
|
111 | - 'custom_widget_3' => array( |
|
112 | - 'text', |
|
113 | - |
|
114 | - array( |
|
115 | - 'title' => '', |
|
116 | - 'text' => wp_kses_post( '<div class="row"><div class="col-xs-12"><h3>Homepage Widget</h3><p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p></div></div>' ), |
|
117 | - ), |
|
118 | - ), |
|
119 | - ), |
|
120 | - |
|
121 | - 'sidebar-footer' => array( |
|
122 | - 'custom_widget_1' => array( |
|
123 | - 'text', |
|
124 | - |
|
125 | - array( |
|
126 | - 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
127 | - 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
128 | - ), |
|
129 | - ), |
|
130 | - |
|
131 | - 'custom_widget_2' => array( |
|
132 | - 'text', |
|
133 | - |
|
134 | - array( |
|
135 | - 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
136 | - 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
137 | - ), |
|
138 | - ), |
|
139 | - |
|
140 | - 'custom_widget_3' => array( |
|
141 | - 'text', |
|
142 | - |
|
143 | - array( |
|
144 | - 'title' => esc_html__( 'Contact us:', 'lsx' ), |
|
145 | - 'text' => wp_kses_post( '<a href="mailto:[email protected]><i class="fa fa-envelope fa-fw"></i> [email protected]</a><br><a href="tel:+27214489843"><i class="fa fa-phone fa-fw"></i> +27 21 448 9843</a><br><i class="fa fa-skype fa-fw"></i> /lightspeeddevelopment' ), |
|
146 | - ), |
|
147 | - ), |
|
148 | - ), |
|
149 | - |
|
150 | - 'sidebar-footer-cta' => array( |
|
151 | - 'custom_widget_1' => array( |
|
152 | - 'text', |
|
153 | - |
|
154 | - array( |
|
155 | - 'title' => esc_html__( 'A Footer Call to Action', 'lsx' ), |
|
156 | - 'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.', 'lsx' ), |
|
157 | - ), |
|
158 | - ), |
|
159 | - ), |
|
160 | - ), |
|
161 | - |
|
162 | - 'posts' => array( |
|
163 | - 'home' => array( |
|
164 | - 'template' => 'page-templates/template-front-page.php', |
|
165 | - 'thumbnail' => '{{image-banner-example-01}}', |
|
166 | - 'post_title' => esc_html__( 'LSX is a free WordPress theme', 'lsx' ), |
|
167 | - 'post_content' => '', |
|
168 | - ), |
|
169 | - |
|
170 | - 'about' => array( |
|
171 | - 'thumbnail' => '{{image-banner-example-02}}', |
|
172 | - ), |
|
173 | - |
|
174 | - 'blog', |
|
175 | - |
|
176 | - 'contact' => array( |
|
177 | - 'thumbnail' => '{{image-banner-example-03}}', |
|
178 | - ), |
|
179 | - ), |
|
180 | - |
|
181 | - 'attachments' => array( |
|
182 | - 'image-banner-example-01' => array( |
|
183 | - 'post_title' => esc_html_x( 'Banner Example 01', 'Theme starter content', 'lsx' ), |
|
184 | - 'file' => 'assets/images/admin/banner-example-01.jpg', |
|
185 | - ), |
|
186 | - |
|
187 | - 'image-banner-example-02' => array( |
|
188 | - 'post_title' => esc_html_x( 'Banner Example 02', 'Theme starter content', 'lsx' ), |
|
189 | - 'file' => 'assets/images/admin/banner-example-02.jpg', |
|
190 | - ), |
|
191 | - |
|
192 | - 'image-banner-example-03' => array( |
|
193 | - 'post_title' => esc_html_x( 'Banner Example 03', 'Theme starter content', 'lsx' ), |
|
194 | - 'file' => 'assets/images/admin/banner-example-03.jpg', |
|
195 | - ), |
|
196 | - ), |
|
197 | - |
|
198 | - 'options' => array( |
|
199 | - 'show_on_front' => 'page', |
|
200 | - 'page_on_front' => '{{home}}', |
|
201 | - 'page_for_posts' => '{{blog}}', |
|
202 | - 'blogdescription' => esc_html__( 'LSX starter content example', 'lsx' ), |
|
203 | - ), |
|
204 | - |
|
205 | - 'nav_menus' => array( |
|
206 | - 'primary' => array( |
|
207 | - 'name' => esc_html__( 'Primary Menu', 'lsx' ), |
|
208 | - |
|
209 | - 'items' => array( |
|
210 | - 'page_home', |
|
211 | - 'page_about', |
|
212 | - 'page_blog', |
|
213 | - 'page_contact', |
|
214 | - ), |
|
215 | - ), |
|
216 | - |
|
217 | - 'top-menu' => array( |
|
218 | - 'name' => esc_html__( 'Top Menu', 'lsx' ), |
|
219 | - |
|
220 | - 'items' => array( |
|
221 | - 'custom_link_1' => array( |
|
222 | - 'title' => 'View Map', |
|
223 | - 'url' => 'https://www.google.com/maps/place/LightSpeed+WordPress+Development/@-33.92945,18.45345,17z/data=!3m1!4b1!4m2!3m1!1s0x1dcc5da1b2446d25:0xc8ecdb1cc8afd170', |
|
224 | - 'classes' => 'map', |
|
225 | - ), |
|
226 | - |
|
227 | - 'custom_link_2' => array( |
|
228 | - 'title' => '+27 21 448 9843', |
|
229 | - 'url' => 'tel:+27214489843', |
|
230 | - 'classes' => 'tel', |
|
231 | - ), |
|
232 | - |
|
233 | - 'custom_link_3' => array( |
|
234 | - 'title' => '[email protected]', |
|
235 | - 'url' => 'mailto:[email protected]', |
|
236 | - 'classes' => 'email', |
|
237 | - ), |
|
238 | - |
|
239 | - 'page_contact' => array( |
|
240 | - 'classes' => 'cta', |
|
241 | - ), |
|
242 | - ), |
|
243 | - ), |
|
244 | - |
|
245 | - 'social' => array( |
|
246 | - 'name' => esc_html__( 'Social Menu', 'lsx' ), |
|
247 | - |
|
248 | - 'items' => array( |
|
249 | - 'link_facebook', |
|
250 | - 'link_foursquare', |
|
251 | - 'link_github', |
|
252 | - 'link_instagram', |
|
253 | - 'link_linkedin', |
|
254 | - 'link_pinterest', |
|
255 | - 'link_twitter', |
|
256 | - 'link_youtube', |
|
257 | - ), |
|
258 | - ), |
|
259 | - |
|
260 | - 'footer' => array( |
|
261 | - 'name' => esc_html__( 'Footer Menu', 'lsx' ), |
|
262 | - |
|
263 | - 'items' => array( |
|
264 | - 'page_about', |
|
265 | - 'page_contact', |
|
266 | - ), |
|
267 | - ), |
|
268 | - ), |
|
269 | - |
|
270 | - 'theme_mods' => array( |
|
271 | - 'lsx_header_fixed' => true, |
|
272 | - 'lsx_header_search' => false, |
|
273 | - 'lsx_layout' => '1c', |
|
274 | - ), |
|
275 | - ) ); |
|
276 | - } |
|
89 | + // add_theme_support( 'woocommerce' );. |
|
90 | + add_theme_support( 'starter-content', array( |
|
91 | + 'widgets' => array( |
|
92 | + 'sidebar-home' => array( |
|
93 | + 'custom_widget_1' => array( |
|
94 | + 'text', |
|
95 | + |
|
96 | + array( |
|
97 | + 'title' => '', |
|
98 | + 'text' => wp_kses_post( '<div class="row"><div class="col-sm-12 text-center"><h3>Build your perfect website <small>with the LSX theme</small></h3></div></div><div class="row"><div class="col-sm-4 text-center"><h4>Fast</h4><p>"Quick" isn\'t a word most people use when describing their website building experience.</p></div><div class="col-sm-4 text-center"><h4>Easy</h4><p>We\'ve built websites for countless clients, and we know what kind of back-end makes sense easily.</p></div><div class="col-sm-4 text-center"><h4>Comprehensive</h4><p>The LSX extensions come with features out the box that are essential.</p></div></div>' ), |
|
99 | + ), |
|
100 | + ), |
|
101 | + |
|
102 | + 'custom_widget_2' => array( |
|
103 | + 'text', |
|
104 | + |
|
105 | + array( |
|
106 | + 'title' => '', |
|
107 | + 'text' => wp_kses_post( '<div class="lsx-full-width-alt"><div class="row"><div class="col-xs-12"><h3>A big CTA title</h3><p class="text-center"><a class="btn cta-btn" href="http://www.lsdeb.biz/" target="_blank" rel="noreferrer noopener">Hire Us</a><p></div></div></div>' ), |
|
108 | + ), |
|
109 | + ), |
|
110 | + |
|
111 | + 'custom_widget_3' => array( |
|
112 | + 'text', |
|
113 | + |
|
114 | + array( |
|
115 | + 'title' => '', |
|
116 | + 'text' => wp_kses_post( '<div class="row"><div class="col-xs-12"><h3>Homepage Widget</h3><p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p></div></div>' ), |
|
117 | + ), |
|
118 | + ), |
|
119 | + ), |
|
120 | + |
|
121 | + 'sidebar-footer' => array( |
|
122 | + 'custom_widget_1' => array( |
|
123 | + 'text', |
|
124 | + |
|
125 | + array( |
|
126 | + 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
127 | + 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
128 | + ), |
|
129 | + ), |
|
130 | + |
|
131 | + 'custom_widget_2' => array( |
|
132 | + 'text', |
|
133 | + |
|
134 | + array( |
|
135 | + 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
136 | + 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
137 | + ), |
|
138 | + ), |
|
139 | + |
|
140 | + 'custom_widget_3' => array( |
|
141 | + 'text', |
|
142 | + |
|
143 | + array( |
|
144 | + 'title' => esc_html__( 'Contact us:', 'lsx' ), |
|
145 | + 'text' => wp_kses_post( '<a href="mailto:[email protected]><i class="fa fa-envelope fa-fw"></i> [email protected]</a><br><a href="tel:+27214489843"><i class="fa fa-phone fa-fw"></i> +27 21 448 9843</a><br><i class="fa fa-skype fa-fw"></i> /lightspeeddevelopment' ), |
|
146 | + ), |
|
147 | + ), |
|
148 | + ), |
|
149 | + |
|
150 | + 'sidebar-footer-cta' => array( |
|
151 | + 'custom_widget_1' => array( |
|
152 | + 'text', |
|
153 | + |
|
154 | + array( |
|
155 | + 'title' => esc_html__( 'A Footer Call to Action', 'lsx' ), |
|
156 | + 'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.', 'lsx' ), |
|
157 | + ), |
|
158 | + ), |
|
159 | + ), |
|
160 | + ), |
|
161 | + |
|
162 | + 'posts' => array( |
|
163 | + 'home' => array( |
|
164 | + 'template' => 'page-templates/template-front-page.php', |
|
165 | + 'thumbnail' => '{{image-banner-example-01}}', |
|
166 | + 'post_title' => esc_html__( 'LSX is a free WordPress theme', 'lsx' ), |
|
167 | + 'post_content' => '', |
|
168 | + ), |
|
169 | + |
|
170 | + 'about' => array( |
|
171 | + 'thumbnail' => '{{image-banner-example-02}}', |
|
172 | + ), |
|
173 | + |
|
174 | + 'blog', |
|
175 | + |
|
176 | + 'contact' => array( |
|
177 | + 'thumbnail' => '{{image-banner-example-03}}', |
|
178 | + ), |
|
179 | + ), |
|
180 | + |
|
181 | + 'attachments' => array( |
|
182 | + 'image-banner-example-01' => array( |
|
183 | + 'post_title' => esc_html_x( 'Banner Example 01', 'Theme starter content', 'lsx' ), |
|
184 | + 'file' => 'assets/images/admin/banner-example-01.jpg', |
|
185 | + ), |
|
186 | + |
|
187 | + 'image-banner-example-02' => array( |
|
188 | + 'post_title' => esc_html_x( 'Banner Example 02', 'Theme starter content', 'lsx' ), |
|
189 | + 'file' => 'assets/images/admin/banner-example-02.jpg', |
|
190 | + ), |
|
191 | + |
|
192 | + 'image-banner-example-03' => array( |
|
193 | + 'post_title' => esc_html_x( 'Banner Example 03', 'Theme starter content', 'lsx' ), |
|
194 | + 'file' => 'assets/images/admin/banner-example-03.jpg', |
|
195 | + ), |
|
196 | + ), |
|
197 | + |
|
198 | + 'options' => array( |
|
199 | + 'show_on_front' => 'page', |
|
200 | + 'page_on_front' => '{{home}}', |
|
201 | + 'page_for_posts' => '{{blog}}', |
|
202 | + 'blogdescription' => esc_html__( 'LSX starter content example', 'lsx' ), |
|
203 | + ), |
|
204 | + |
|
205 | + 'nav_menus' => array( |
|
206 | + 'primary' => array( |
|
207 | + 'name' => esc_html__( 'Primary Menu', 'lsx' ), |
|
208 | + |
|
209 | + 'items' => array( |
|
210 | + 'page_home', |
|
211 | + 'page_about', |
|
212 | + 'page_blog', |
|
213 | + 'page_contact', |
|
214 | + ), |
|
215 | + ), |
|
216 | + |
|
217 | + 'top-menu' => array( |
|
218 | + 'name' => esc_html__( 'Top Menu', 'lsx' ), |
|
219 | + |
|
220 | + 'items' => array( |
|
221 | + 'custom_link_1' => array( |
|
222 | + 'title' => 'View Map', |
|
223 | + 'url' => 'https://www.google.com/maps/place/LightSpeed+WordPress+Development/@-33.92945,18.45345,17z/data=!3m1!4b1!4m2!3m1!1s0x1dcc5da1b2446d25:0xc8ecdb1cc8afd170', |
|
224 | + 'classes' => 'map', |
|
225 | + ), |
|
226 | + |
|
227 | + 'custom_link_2' => array( |
|
228 | + 'title' => '+27 21 448 9843', |
|
229 | + 'url' => 'tel:+27214489843', |
|
230 | + 'classes' => 'tel', |
|
231 | + ), |
|
232 | + |
|
233 | + 'custom_link_3' => array( |
|
234 | + 'title' => '[email protected]', |
|
235 | + 'url' => 'mailto:[email protected]', |
|
236 | + 'classes' => 'email', |
|
237 | + ), |
|
238 | + |
|
239 | + 'page_contact' => array( |
|
240 | + 'classes' => 'cta', |
|
241 | + ), |
|
242 | + ), |
|
243 | + ), |
|
244 | + |
|
245 | + 'social' => array( |
|
246 | + 'name' => esc_html__( 'Social Menu', 'lsx' ), |
|
247 | + |
|
248 | + 'items' => array( |
|
249 | + 'link_facebook', |
|
250 | + 'link_foursquare', |
|
251 | + 'link_github', |
|
252 | + 'link_instagram', |
|
253 | + 'link_linkedin', |
|
254 | + 'link_pinterest', |
|
255 | + 'link_twitter', |
|
256 | + 'link_youtube', |
|
257 | + ), |
|
258 | + ), |
|
259 | + |
|
260 | + 'footer' => array( |
|
261 | + 'name' => esc_html__( 'Footer Menu', 'lsx' ), |
|
262 | + |
|
263 | + 'items' => array( |
|
264 | + 'page_about', |
|
265 | + 'page_contact', |
|
266 | + ), |
|
267 | + ), |
|
268 | + ), |
|
269 | + |
|
270 | + 'theme_mods' => array( |
|
271 | + 'lsx_header_fixed' => true, |
|
272 | + 'lsx_header_search' => false, |
|
273 | + 'lsx_layout' => '1c', |
|
274 | + ), |
|
275 | + ) ); |
|
276 | + } |
|
277 | 277 | |
278 | 278 | endif; |
279 | 279 | |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | |
282 | 282 | if ( ! function_exists( 'lsx_init' ) ) : |
283 | 283 | |
284 | - /** |
|
285 | - * Theme init action. |
|
286 | - * |
|
287 | - * @package lsx |
|
288 | - * @subpackage config |
|
289 | - */ |
|
290 | - function lsx_init() { |
|
291 | - add_post_type_support( 'page', 'excerpt' ); |
|
284 | + /** |
|
285 | + * Theme init action. |
|
286 | + * |
|
287 | + * @package lsx |
|
288 | + * @subpackage config |
|
289 | + */ |
|
290 | + function lsx_init() { |
|
291 | + add_post_type_support( 'page', 'excerpt' ); |
|
292 | 292 | |
293 | - if ( class_exists( 'WooCommerce' ) ) { |
|
294 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); |
|
295 | - } |
|
293 | + if ( class_exists( 'WooCommerce' ) ) { |
|
294 | + remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); |
|
295 | + } |
|
296 | 296 | |
297 | - remove_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce', 10 ); |
|
298 | - } |
|
297 | + remove_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce', 10 ); |
|
298 | + } |
|
299 | 299 | |
300 | 300 | endif; |
301 | 301 | |
@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | |
304 | 304 | if ( ! function_exists( 'lsx_process_content_width' ) ) : |
305 | 305 | |
306 | - /** |
|
307 | - * Overwrite the $content_width var, based on the layout of the page. |
|
308 | - * |
|
309 | - * @package lsx |
|
310 | - * @subpackage config |
|
311 | - */ |
|
312 | - function lsx_process_content_width() { |
|
313 | - global $content_width; |
|
314 | - |
|
315 | - if ( |
|
316 | - is_page_template( 'page-templates/template-front-page.php' ) || |
|
317 | - is_page_template( 'page-templates/template-full-width.php' ) |
|
318 | - ) { |
|
319 | - $content_width = 1140; |
|
320 | - } |
|
321 | - } |
|
306 | + /** |
|
307 | + * Overwrite the $content_width var, based on the layout of the page. |
|
308 | + * |
|
309 | + * @package lsx |
|
310 | + * @subpackage config |
|
311 | + */ |
|
312 | + function lsx_process_content_width() { |
|
313 | + global $content_width; |
|
314 | + |
|
315 | + if ( |
|
316 | + is_page_template( 'page-templates/template-front-page.php' ) || |
|
317 | + is_page_template( 'page-templates/template-full-width.php' ) |
|
318 | + ) { |
|
319 | + $content_width = 1140; |
|
320 | + } |
|
321 | + } |
|
322 | 322 | |
323 | 323 | endif; |
324 | 324 | |
@@ -326,31 +326,31 @@ discard block |
||
326 | 326 | |
327 | 327 | if ( ! function_exists( 'lsx_file_get_contents' ) ) : |
328 | 328 | |
329 | - /** |
|
330 | - * Get file contents. |
|
331 | - * |
|
332 | - * @package lsx |
|
333 | - * @subpackage config |
|
334 | - */ |
|
335 | - function lsx_file_get_contents( $file ) { |
|
336 | - if ( file_exists( $file ) ) { |
|
337 | - global $wp_filesystem; |
|
338 | - |
|
339 | - if ( empty( $wp_filesystem ) ) { |
|
340 | - require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
341 | - WP_Filesystem(); |
|
342 | - } |
|
343 | - |
|
344 | - if ( $wp_filesystem ) { |
|
345 | - $contents = $wp_filesystem->get_contents( $file ); |
|
346 | - |
|
347 | - if ( ! empty( $contents ) ) { |
|
348 | - return $contents; |
|
349 | - } |
|
350 | - } |
|
351 | - } |
|
352 | - |
|
353 | - return ''; |
|
354 | - } |
|
329 | + /** |
|
330 | + * Get file contents. |
|
331 | + * |
|
332 | + * @package lsx |
|
333 | + * @subpackage config |
|
334 | + */ |
|
335 | + function lsx_file_get_contents( $file ) { |
|
336 | + if ( file_exists( $file ) ) { |
|
337 | + global $wp_filesystem; |
|
338 | + |
|
339 | + if ( empty( $wp_filesystem ) ) { |
|
340 | + require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
341 | + WP_Filesystem(); |
|
342 | + } |
|
343 | + |
|
344 | + if ( $wp_filesystem ) { |
|
345 | + $contents = $wp_filesystem->get_contents( $file ); |
|
346 | + |
|
347 | + if ( ! empty( $contents ) ) { |
|
348 | + return $contents; |
|
349 | + } |
|
350 | + } |
|
351 | + } |
|
352 | + |
|
353 | + return ''; |
|
354 | + } |
|
355 | 355 | |
356 | 356 | endif; |
@@ -7,54 +7,54 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_get_avatar' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * Comment Form Field Filter. |
|
17 | - * |
|
18 | - * @package lsx |
|
19 | - * @subpackage comment-walker |
|
20 | - */ |
|
21 | - function lsx_get_avatar( $avatar ) { |
|
22 | - $avatar = str_replace( "class='avatar", "class='avatar pull-left media-object ", $avatar ); |
|
23 | - $avatar = str_replace( 'class="avatar', 'class="avatar pull-left media-object ', $avatar ); |
|
24 | - return $avatar; |
|
25 | - } |
|
15 | + /** |
|
16 | + * Comment Form Field Filter. |
|
17 | + * |
|
18 | + * @package lsx |
|
19 | + * @subpackage comment-walker |
|
20 | + */ |
|
21 | + function lsx_get_avatar( $avatar ) { |
|
22 | + $avatar = str_replace( "class='avatar", "class='avatar pull-left media-object ", $avatar ); |
|
23 | + $avatar = str_replace( 'class="avatar', 'class="avatar pull-left media-object ', $avatar ); |
|
24 | + return $avatar; |
|
25 | + } |
|
26 | 26 | |
27 | 27 | endif; |
28 | 28 | |
29 | 29 | add_filter( 'get_avatar', 'lsx_get_avatar' ); |
30 | 30 | |
31 | 31 | add_action( 'admin_bar_menu', function() { |
32 | - remove_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
32 | + remove_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
33 | 33 | }, 0 ); |
34 | 34 | |
35 | 35 | add_action( 'wp_after_admin_bar_render', function() { |
36 | - add_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
36 | + add_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
37 | 37 | } ); |
38 | 38 | |
39 | 39 | if ( ! function_exists( 'lsx_comment_form_fields_filter' ) ) : |
40 | 40 | |
41 | - /** |
|
42 | - * Comment Form Field Filter. |
|
43 | - * |
|
44 | - * @package lsx |
|
45 | - * @subpackage comment-walker |
|
46 | - */ |
|
47 | - function lsx_comment_form_fields_filter( $fields ) { |
|
48 | - foreach ( $fields as &$field ) { |
|
49 | - if ( stristr( 'class=', $field ) ) { |
|
50 | - $field = str_replace( 'class="', 'class="form-control ', $field ); |
|
51 | - } else { |
|
52 | - $field = str_replace( '<input', '<input class="form-control" ', $field ); |
|
53 | - } |
|
54 | - } |
|
55 | - |
|
56 | - return $fields; |
|
57 | - } |
|
41 | + /** |
|
42 | + * Comment Form Field Filter. |
|
43 | + * |
|
44 | + * @package lsx |
|
45 | + * @subpackage comment-walker |
|
46 | + */ |
|
47 | + function lsx_comment_form_fields_filter( $fields ) { |
|
48 | + foreach ( $fields as &$field ) { |
|
49 | + if ( stristr( 'class=', $field ) ) { |
|
50 | + $field = str_replace( 'class="', 'class="form-control ', $field ); |
|
51 | + } else { |
|
52 | + $field = str_replace( '<input', '<input class="form-control" ', $field ); |
|
53 | + } |
|
54 | + } |
|
55 | + |
|
56 | + return $fields; |
|
57 | + } |
|
58 | 58 | |
59 | 59 | endif; |
60 | 60 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
4 | - exit; |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -15,79 +15,79 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class LSX_WC_Widget_Recent_Reviews extends WC_Widget { |
17 | 17 | |
18 | - /** |
|
19 | - * Constructor. |
|
20 | - */ |
|
21 | - public function __construct() { |
|
22 | - $this->widget_cssclass = 'woocommerce widget_recent_reviews'; |
|
23 | - $this->widget_description = __( 'Display a list of your most recent reviews on your site.', 'lsx' ); |
|
24 | - $this->widget_id = 'woocommerce_recent_reviews'; |
|
25 | - $this->widget_name = __( 'WooCommerce recent reviews', 'lsx' ); |
|
26 | - $this->settings = array( |
|
27 | - 'title' => array( |
|
28 | - 'type' => 'text', |
|
29 | - 'std' => __( 'Recent reviews', 'lsx' ), |
|
30 | - 'label' => __( 'Title', 'lsx' ), |
|
31 | - ), |
|
32 | - 'number' => array( |
|
33 | - 'type' => 'number', |
|
34 | - 'step' => 1, |
|
35 | - 'min' => 1, |
|
36 | - 'max' => '', |
|
37 | - 'std' => 10, |
|
38 | - 'label' => __( 'Number of reviews to show', 'lsx' ), |
|
39 | - ), |
|
40 | - ); |
|
18 | + /** |
|
19 | + * Constructor. |
|
20 | + */ |
|
21 | + public function __construct() { |
|
22 | + $this->widget_cssclass = 'woocommerce widget_recent_reviews'; |
|
23 | + $this->widget_description = __( 'Display a list of your most recent reviews on your site.', 'lsx' ); |
|
24 | + $this->widget_id = 'woocommerce_recent_reviews'; |
|
25 | + $this->widget_name = __( 'WooCommerce recent reviews', 'lsx' ); |
|
26 | + $this->settings = array( |
|
27 | + 'title' => array( |
|
28 | + 'type' => 'text', |
|
29 | + 'std' => __( 'Recent reviews', 'lsx' ), |
|
30 | + 'label' => __( 'Title', 'lsx' ), |
|
31 | + ), |
|
32 | + 'number' => array( |
|
33 | + 'type' => 'number', |
|
34 | + 'step' => 1, |
|
35 | + 'min' => 1, |
|
36 | + 'max' => '', |
|
37 | + 'std' => 10, |
|
38 | + 'label' => __( 'Number of reviews to show', 'lsx' ), |
|
39 | + ), |
|
40 | + ); |
|
41 | 41 | |
42 | - parent::__construct(); |
|
43 | - } |
|
42 | + parent::__construct(); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Output widget. |
|
47 | - * |
|
48 | - * @see WP_Widget |
|
49 | - * |
|
50 | - * @param array $args |
|
51 | - * @param array $instance |
|
52 | - */ |
|
53 | - public function widget( $args, $instance ) { |
|
54 | - if ( $this->get_cached_widget( $args ) ) { |
|
55 | - return; |
|
56 | - } |
|
57 | - ob_start(); |
|
58 | - $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std']; |
|
59 | - $comments = get_comments( |
|
60 | - array( |
|
61 | - 'number' => $number, |
|
62 | - 'status' => 'approve', |
|
63 | - 'post_status' => 'publish', |
|
64 | - 'post_type' => 'product', |
|
65 | - 'parent' => 0, |
|
66 | - ) |
|
67 | - ); |
|
45 | + /** |
|
46 | + * Output widget. |
|
47 | + * |
|
48 | + * @see WP_Widget |
|
49 | + * |
|
50 | + * @param array $args |
|
51 | + * @param array $instance |
|
52 | + */ |
|
53 | + public function widget( $args, $instance ) { |
|
54 | + if ( $this->get_cached_widget( $args ) ) { |
|
55 | + return; |
|
56 | + } |
|
57 | + ob_start(); |
|
58 | + $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std']; |
|
59 | + $comments = get_comments( |
|
60 | + array( |
|
61 | + 'number' => $number, |
|
62 | + 'status' => 'approve', |
|
63 | + 'post_status' => 'publish', |
|
64 | + 'post_type' => 'product', |
|
65 | + 'parent' => 0, |
|
66 | + ) |
|
67 | + ); |
|
68 | 68 | |
69 | - if ( $comments ) { |
|
70 | - $this->widget_start( $args, $instance ); |
|
69 | + if ( $comments ) { |
|
70 | + $this->widget_start( $args, $instance ); |
|
71 | 71 | |
72 | - echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) ); |
|
72 | + echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) ); |
|
73 | 73 | |
74 | - global $stored_comment, $_product, $rating; |
|
74 | + global $stored_comment, $_product, $rating; |
|
75 | 75 | |
76 | - the_comment(); |
|
77 | - foreach ( (array) $comments as $comment ) { |
|
78 | - $_product = wc_get_product( $comment->comment_post_ID ); |
|
79 | - $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); |
|
80 | - $stored_comment = $comment; |
|
76 | + the_comment(); |
|
77 | + foreach ( (array) $comments as $comment ) { |
|
78 | + $_product = wc_get_product( $comment->comment_post_ID ); |
|
79 | + $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); |
|
80 | + $stored_comment = $comment; |
|
81 | 81 | |
82 | - wc_get_template( 'content-widget-review.php' ); |
|
83 | - } |
|
82 | + wc_get_template( 'content-widget-review.php' ); |
|
83 | + } |
|
84 | 84 | |
85 | - echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) ); |
|
85 | + echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) ); |
|
86 | 86 | |
87 | - $this->widget_end( $args ); |
|
88 | - } |
|
89 | - $content = ob_get_clean(); |
|
90 | - echo wp_kses_post( $content ); |
|
91 | - $this->cache_widget( $args, $content ); |
|
92 | - } |
|
87 | + $this->widget_end( $args ); |
|
88 | + } |
|
89 | + $content = ob_get_clean(); |
|
90 | + echo wp_kses_post( $content ); |
|
91 | + $this->cache_widget( $args, $content ); |
|
92 | + } |
|
93 | 93 | } |
@@ -8,74 +8,74 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; |
|
11 | + exit; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | if ( ! class_exists( 'Walker_Nav_Menu' ) ) { |
15 | - return; |
|
15 | + return; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if ( ! class_exists( 'LSX_Nav_Walker' ) ) : |
19 | 19 | |
20 | - /** |
|
21 | - * Cleaner walker for wp_nav_menu() |
|
22 | - * |
|
23 | - * Walker_Nav_Menu (WordPress default) example output: |
|
24 | - * <li id="menu-item-8" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8"><a href="/">Home</a></li> |
|
25 | - * <li id="menu-item-9" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-9"><a href="/sample-page/">Sample Page</a></l |
|
26 | - * |
|
27 | - * LSX_Nav_Walker example output: |
|
28 | - * <li class="menu-home"><a href="/">Home</a></li> |
|
29 | - * <li class="menu-sample-page"><a href="/sample-page/">Sample Page</a></li> |
|
30 | - * |
|
31 | - * @package lsx |
|
32 | - * @subpackage navigation |
|
33 | - * @category bootstrap-walker |
|
34 | - */ |
|
35 | - class LSX_Nav_Walker extends Walker_Nav_Menu { |
|
20 | + /** |
|
21 | + * Cleaner walker for wp_nav_menu() |
|
22 | + * |
|
23 | + * Walker_Nav_Menu (WordPress default) example output: |
|
24 | + * <li id="menu-item-8" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8"><a href="/">Home</a></li> |
|
25 | + * <li id="menu-item-9" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-9"><a href="/sample-page/">Sample Page</a></l |
|
26 | + * |
|
27 | + * LSX_Nav_Walker example output: |
|
28 | + * <li class="menu-home"><a href="/">Home</a></li> |
|
29 | + * <li class="menu-sample-page"><a href="/sample-page/">Sample Page</a></li> |
|
30 | + * |
|
31 | + * @package lsx |
|
32 | + * @subpackage navigation |
|
33 | + * @category bootstrap-walker |
|
34 | + */ |
|
35 | + class LSX_Nav_Walker extends Walker_Nav_Menu { |
|
36 | 36 | |
37 | - function check_current( $classes ) { |
|
38 | - return preg_match( '/^(current[-_])|active|dropdown$/', $classes ); |
|
39 | - } |
|
37 | + function check_current( $classes ) { |
|
38 | + return preg_match( '/^(current[-_])|active|dropdown$/', $classes ); |
|
39 | + } |
|
40 | 40 | |
41 | - function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
42 | - $output .= "\n<ul class=\"dropdown-menu\">\n"; |
|
43 | - } |
|
41 | + function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
42 | + $output .= "\n<ul class=\"dropdown-menu\">\n"; |
|
43 | + } |
|
44 | 44 | |
45 | - function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
46 | - $item_html = ''; |
|
45 | + function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
46 | + $item_html = ''; |
|
47 | 47 | |
48 | - if ( isset( $item->title ) ) { |
|
49 | - parent::start_el( $item_html, $item, $depth, $args ); |
|
48 | + if ( isset( $item->title ) ) { |
|
49 | + parent::start_el( $item_html, $item, $depth, $args ); |
|
50 | 50 | |
51 | - if ( $item->is_dropdown && ( 0 === $depth ) ) { |
|
52 | - $item_html = str_replace( '<a', '<a class="dropdown-toggle" data-target="#"', $item_html ); |
|
53 | - $item_html = str_replace( '</a>', ' <b class="caret"></b></a>', $item_html ); |
|
54 | - } elseif ( stristr( $item_html, 'li class="divider"' ) ) { |
|
55 | - $item_html = preg_replace( '/<a[^>]*>.*?<\/a>/iU', '', $item_html ); |
|
56 | - } elseif ( stristr( $item_html, 'li class="dropdown-header"' ) ) { |
|
57 | - $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html ); |
|
58 | - } |
|
51 | + if ( $item->is_dropdown && ( 0 === $depth ) ) { |
|
52 | + $item_html = str_replace( '<a', '<a class="dropdown-toggle" data-target="#"', $item_html ); |
|
53 | + $item_html = str_replace( '</a>', ' <b class="caret"></b></a>', $item_html ); |
|
54 | + } elseif ( stristr( $item_html, 'li class="divider"' ) ) { |
|
55 | + $item_html = preg_replace( '/<a[^>]*>.*?<\/a>/iU', '', $item_html ); |
|
56 | + } elseif ( stristr( $item_html, 'li class="dropdown-header"' ) ) { |
|
57 | + $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html ); |
|
58 | + } |
|
59 | 59 | |
60 | - $item_html = apply_filters( 'lsx_wp_nav_menu_item', $item_html ); |
|
61 | - $output .= $item_html; |
|
62 | - } |
|
63 | - } |
|
60 | + $item_html = apply_filters( 'lsx_wp_nav_menu_item', $item_html ); |
|
61 | + $output .= $item_html; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { |
|
66 | - $element->is_dropdown = ( ( ! empty( $children_elements[ $element->ID ] ) && ( ( $depth + 1 ) < $max_depth || ( 0 === $max_depth ) ) ) ); |
|
65 | + function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { |
|
66 | + $element->is_dropdown = ( ( ! empty( $children_elements[ $element->ID ] ) && ( ( $depth + 1 ) < $max_depth || ( 0 === $max_depth ) ) ) ); |
|
67 | 67 | |
68 | - if ( $element->is_dropdown ) { |
|
69 | - if ( $depth > 0 ) { |
|
70 | - $element->classes[] = 'dropdown-submenu'; |
|
71 | - } else { |
|
72 | - $element->classes[] = 'dropdown'; |
|
73 | - } |
|
74 | - } |
|
68 | + if ( $element->is_dropdown ) { |
|
69 | + if ( $depth > 0 ) { |
|
70 | + $element->classes[] = 'dropdown-submenu'; |
|
71 | + } else { |
|
72 | + $element->classes[] = 'dropdown'; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
77 | - } |
|
76 | + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
77 | + } |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | 81 | endif; |
@@ -10,212 +10,212 @@ |
||
10 | 10 | * @since 11.6 |
11 | 11 | */ |
12 | 12 | class LSX_Schema_Utils { |
13 | - /** |
|
14 | - * Determines whether a given post type should have Review schema. |
|
15 | - * |
|
16 | - * @param string $post_type Post type to check. |
|
17 | - * @param string $comparison_type Post type to check against. |
|
18 | - * |
|
19 | - * @return bool True if it has schema, false if not. |
|
20 | - */ |
|
21 | - public static function is_type( $post_type = null, $comparison_type = null ) { |
|
22 | - if ( is_null( $comparison_type ) ) { |
|
23 | - return false; |
|
24 | - } |
|
25 | - if ( is_null( $post_type ) ) { |
|
26 | - $post_type = get_post_type(); |
|
27 | - } |
|
28 | - /** |
|
29 | - * Filter: 'wpseo_schema_$this->post_type_post_types' - Allow changing for which post types we output Review schema. |
|
30 | - * |
|
31 | - * @api string[] $post_types The post types for which we output Review. |
|
32 | - */ |
|
33 | - $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) ); |
|
34 | - return in_array( $post_type, $post_types ); |
|
35 | - } |
|
36 | - /** |
|
37 | - * Retrieve a users Schema ID. |
|
38 | - * |
|
39 | - * @param string $place_id The Name of the Reviewer you need a for. |
|
40 | - * @param string $type the type of the place. |
|
41 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
42 | - * |
|
43 | - * @return string The user's schema ID. |
|
44 | - */ |
|
45 | - public static function get_places_schema_id( $place_id, $type, $context ) { |
|
46 | - $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) ); |
|
47 | - return trailingslashit( $url ); |
|
48 | - } |
|
49 | - /** |
|
50 | - * Retrieve a users Schema ID. |
|
51 | - * |
|
52 | - * @param string $name The Name of the Reviewer you need a for. |
|
53 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
54 | - * |
|
55 | - * @return string The user's schema ID. |
|
56 | - */ |
|
57 | - public static function get_subtrip_schema_id( $name, $context ) { |
|
58 | - $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id ); |
|
59 | - return trailingslashit( $url ); |
|
60 | - } |
|
61 | - /** |
|
62 | - * Retrieve an offer Schema ID. |
|
63 | - * |
|
64 | - * @param string $id post ID of the place being added. |
|
65 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
66 | - * @param string $local if the Schema is local true / false. |
|
67 | - * |
|
68 | - * @return string The user's schema ID. |
|
69 | - */ |
|
70 | - public static function get_offer_schema_id( $id, $context, $local = false ) { |
|
71 | - if ( false === $local ) { |
|
72 | - $url = $context->site_url; |
|
73 | - } else { |
|
74 | - $url = get_permalink( $context->id ); |
|
75 | - } |
|
76 | - $url .= '#/schema/offer/'; |
|
77 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
78 | - return trailingslashit( $url ); |
|
79 | - } |
|
80 | - /** |
|
81 | - * Retrieve an review Schema ID. |
|
82 | - * |
|
83 | - * @param string $id post ID of the place being added. |
|
84 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
85 | - * @param string $local if the Schema is local true / false. |
|
86 | - * |
|
87 | - * @return string The user's schema ID. |
|
88 | - */ |
|
89 | - public static function get_review_schema_id( $id, $context, $local = false ) { |
|
90 | - if ( false === $local ) { |
|
91 | - $url = $context->site_url; |
|
92 | - } else { |
|
93 | - $url = get_permalink( $context->id ); |
|
94 | - } |
|
95 | - $url .= '#/schema/review/'; |
|
96 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
97 | - return trailingslashit( $url ); |
|
98 | - } |
|
99 | - /** |
|
100 | - * Retrieve an Article Schema ID. |
|
101 | - * |
|
102 | - * @param string $id post ID of the place being added. |
|
103 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
104 | - * @param string $local if the Schema is local true / false. |
|
105 | - * |
|
106 | - * @return string The user's schema ID. |
|
107 | - */ |
|
108 | - public static function get_article_schema_id( $id, $context, $local = false ) { |
|
109 | - if ( false === $local ) { |
|
110 | - $url = get_permalink( $id ) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
111 | - } else { |
|
112 | - $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) ); |
|
113 | - } |
|
114 | - return trailingslashit( $url ); |
|
115 | - } |
|
116 | - /** |
|
117 | - * Retrieve a users Schema ID. |
|
118 | - * |
|
119 | - * @param string $name The Name of the Reviewer you need a for. |
|
120 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
121 | - * |
|
122 | - * @return string The user's schema ID. |
|
123 | - */ |
|
124 | - public static function get_author_schema_id( $name, $email, $context ) { |
|
125 | - return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $name . $email ); |
|
126 | - } |
|
127 | - /** |
|
128 | - * Generates the place graph piece for the subtrip / Itinerary arrays. |
|
129 | - * |
|
130 | - * @param array $data subTrip / itinerary data. |
|
131 | - * @param string $type The type in data to save the terms in. |
|
132 | - * @param string $post_id The post ID of the current Place to add. |
|
133 | - * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
134 | - * @param string $contained_in The @id of the containedIn place. |
|
135 | - * |
|
136 | - * @return mixed array $data Place data. |
|
137 | - */ |
|
138 | - public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) { |
|
139 | - $at_id = self::get_places_schema_id( $post_id, $type, $context ); |
|
140 | - $place = array( |
|
141 | - '@type' => $type, |
|
142 | - '@id' => $at_id, |
|
143 | - 'name' => get_the_title( $post_id ), |
|
144 | - 'description' => get_the_excerpt( $post_id ), |
|
145 | - 'url' => get_permalink( $post_id ), |
|
146 | - ); |
|
147 | - if ( false !== $contained_in ) { |
|
148 | - $place['containedInPlace'] = array( |
|
149 | - '@type' => 'Country', |
|
150 | - '@id' => $contained_in, |
|
151 | - ); |
|
152 | - } |
|
153 | - $data[] = $place; |
|
154 | - return $data; |
|
155 | - } |
|
156 | - /** |
|
157 | - * Adds an image node if the post has a featured image. |
|
158 | - * |
|
159 | - * @param array $data The Review data. |
|
160 | - * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
161 | - * |
|
162 | - * @return array $data The Review data. |
|
163 | - */ |
|
164 | - public static function add_image( $data, $context ) { |
|
165 | - if ( $context->has_image ) { |
|
166 | - $data['image'] = array( |
|
167 | - '@id' => $context->canonical . \WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH, |
|
168 | - ); |
|
169 | - } |
|
170 | - return $data; |
|
171 | - } |
|
172 | - /** |
|
173 | - * Generates the itemReviewed schema |
|
174 | - * |
|
175 | - * @param array $items The array of IDS. |
|
176 | - * @param string $type The schema type. |
|
177 | - * @return array $schema An array of the schema markup. |
|
178 | - */ |
|
179 | - public static function get_item_reviewed( $items = array(), $type = '' ) { |
|
180 | - $schema = array(); |
|
181 | - if ( false !== $items && ! empty( $items ) && '' !== $type ) { |
|
182 | - array_unique( $items ); |
|
183 | - foreach ( $items as $item ) { |
|
184 | - $title = get_the_title( $item ); |
|
185 | - if ( '' !== $title ) { |
|
186 | - $item_schema = array( |
|
187 | - '@type' => $type, |
|
188 | - 'name' => $title, |
|
189 | - ); |
|
190 | - $schema[] = $item_schema; |
|
191 | - } |
|
192 | - } |
|
193 | - } |
|
194 | - return $schema; |
|
195 | - } |
|
196 | - /** |
|
197 | - * Adds a term or multiple terms, comma separated, to a field. |
|
198 | - * |
|
199 | - * @param array $data Review data. |
|
200 | - * @param string $post_id The ID of the item to fetch terms. |
|
201 | - * @param string $key The key in data to save the terms in. |
|
202 | - * @param string $taxonomy The taxonomy to retrieve the terms from. |
|
203 | - * |
|
204 | - * @return mixed array $data Review data. |
|
205 | - */ |
|
206 | - public static function add_terms( $data, $post_id, $key, $taxonomy ) { |
|
207 | - $terms = get_the_terms( $post_id, $taxonomy ); |
|
208 | - if ( is_array( $terms ) ) { |
|
209 | - $keywords = array(); |
|
210 | - foreach ( $terms as $term ) { |
|
211 | - // We are checking against the WordPress internal translation. |
|
212 | - // @codingStandardsIgnoreLine |
|
213 | - if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) { |
|
214 | - $keywords[] = $term->name; |
|
215 | - } |
|
216 | - } |
|
217 | - $data[ $key ] = implode( ',', $keywords ); |
|
218 | - } |
|
219 | - return $data; |
|
220 | - } |
|
13 | + /** |
|
14 | + * Determines whether a given post type should have Review schema. |
|
15 | + * |
|
16 | + * @param string $post_type Post type to check. |
|
17 | + * @param string $comparison_type Post type to check against. |
|
18 | + * |
|
19 | + * @return bool True if it has schema, false if not. |
|
20 | + */ |
|
21 | + public static function is_type( $post_type = null, $comparison_type = null ) { |
|
22 | + if ( is_null( $comparison_type ) ) { |
|
23 | + return false; |
|
24 | + } |
|
25 | + if ( is_null( $post_type ) ) { |
|
26 | + $post_type = get_post_type(); |
|
27 | + } |
|
28 | + /** |
|
29 | + * Filter: 'wpseo_schema_$this->post_type_post_types' - Allow changing for which post types we output Review schema. |
|
30 | + * |
|
31 | + * @api string[] $post_types The post types for which we output Review. |
|
32 | + */ |
|
33 | + $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) ); |
|
34 | + return in_array( $post_type, $post_types ); |
|
35 | + } |
|
36 | + /** |
|
37 | + * Retrieve a users Schema ID. |
|
38 | + * |
|
39 | + * @param string $place_id The Name of the Reviewer you need a for. |
|
40 | + * @param string $type the type of the place. |
|
41 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
42 | + * |
|
43 | + * @return string The user's schema ID. |
|
44 | + */ |
|
45 | + public static function get_places_schema_id( $place_id, $type, $context ) { |
|
46 | + $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) ); |
|
47 | + return trailingslashit( $url ); |
|
48 | + } |
|
49 | + /** |
|
50 | + * Retrieve a users Schema ID. |
|
51 | + * |
|
52 | + * @param string $name The Name of the Reviewer you need a for. |
|
53 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
54 | + * |
|
55 | + * @return string The user's schema ID. |
|
56 | + */ |
|
57 | + public static function get_subtrip_schema_id( $name, $context ) { |
|
58 | + $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id ); |
|
59 | + return trailingslashit( $url ); |
|
60 | + } |
|
61 | + /** |
|
62 | + * Retrieve an offer Schema ID. |
|
63 | + * |
|
64 | + * @param string $id post ID of the place being added. |
|
65 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
66 | + * @param string $local if the Schema is local true / false. |
|
67 | + * |
|
68 | + * @return string The user's schema ID. |
|
69 | + */ |
|
70 | + public static function get_offer_schema_id( $id, $context, $local = false ) { |
|
71 | + if ( false === $local ) { |
|
72 | + $url = $context->site_url; |
|
73 | + } else { |
|
74 | + $url = get_permalink( $context->id ); |
|
75 | + } |
|
76 | + $url .= '#/schema/offer/'; |
|
77 | + $url .= wp_hash( $id . get_the_title( $id ) ); |
|
78 | + return trailingslashit( $url ); |
|
79 | + } |
|
80 | + /** |
|
81 | + * Retrieve an review Schema ID. |
|
82 | + * |
|
83 | + * @param string $id post ID of the place being added. |
|
84 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
85 | + * @param string $local if the Schema is local true / false. |
|
86 | + * |
|
87 | + * @return string The user's schema ID. |
|
88 | + */ |
|
89 | + public static function get_review_schema_id( $id, $context, $local = false ) { |
|
90 | + if ( false === $local ) { |
|
91 | + $url = $context->site_url; |
|
92 | + } else { |
|
93 | + $url = get_permalink( $context->id ); |
|
94 | + } |
|
95 | + $url .= '#/schema/review/'; |
|
96 | + $url .= wp_hash( $id . get_the_title( $id ) ); |
|
97 | + return trailingslashit( $url ); |
|
98 | + } |
|
99 | + /** |
|
100 | + * Retrieve an Article Schema ID. |
|
101 | + * |
|
102 | + * @param string $id post ID of the place being added. |
|
103 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
104 | + * @param string $local if the Schema is local true / false. |
|
105 | + * |
|
106 | + * @return string The user's schema ID. |
|
107 | + */ |
|
108 | + public static function get_article_schema_id( $id, $context, $local = false ) { |
|
109 | + if ( false === $local ) { |
|
110 | + $url = get_permalink( $id ) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
111 | + } else { |
|
112 | + $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) ); |
|
113 | + } |
|
114 | + return trailingslashit( $url ); |
|
115 | + } |
|
116 | + /** |
|
117 | + * Retrieve a users Schema ID. |
|
118 | + * |
|
119 | + * @param string $name The Name of the Reviewer you need a for. |
|
120 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
121 | + * |
|
122 | + * @return string The user's schema ID. |
|
123 | + */ |
|
124 | + public static function get_author_schema_id( $name, $email, $context ) { |
|
125 | + return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $name . $email ); |
|
126 | + } |
|
127 | + /** |
|
128 | + * Generates the place graph piece for the subtrip / Itinerary arrays. |
|
129 | + * |
|
130 | + * @param array $data subTrip / itinerary data. |
|
131 | + * @param string $type The type in data to save the terms in. |
|
132 | + * @param string $post_id The post ID of the current Place to add. |
|
133 | + * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
134 | + * @param string $contained_in The @id of the containedIn place. |
|
135 | + * |
|
136 | + * @return mixed array $data Place data. |
|
137 | + */ |
|
138 | + public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) { |
|
139 | + $at_id = self::get_places_schema_id( $post_id, $type, $context ); |
|
140 | + $place = array( |
|
141 | + '@type' => $type, |
|
142 | + '@id' => $at_id, |
|
143 | + 'name' => get_the_title( $post_id ), |
|
144 | + 'description' => get_the_excerpt( $post_id ), |
|
145 | + 'url' => get_permalink( $post_id ), |
|
146 | + ); |
|
147 | + if ( false !== $contained_in ) { |
|
148 | + $place['containedInPlace'] = array( |
|
149 | + '@type' => 'Country', |
|
150 | + '@id' => $contained_in, |
|
151 | + ); |
|
152 | + } |
|
153 | + $data[] = $place; |
|
154 | + return $data; |
|
155 | + } |
|
156 | + /** |
|
157 | + * Adds an image node if the post has a featured image. |
|
158 | + * |
|
159 | + * @param array $data The Review data. |
|
160 | + * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
161 | + * |
|
162 | + * @return array $data The Review data. |
|
163 | + */ |
|
164 | + public static function add_image( $data, $context ) { |
|
165 | + if ( $context->has_image ) { |
|
166 | + $data['image'] = array( |
|
167 | + '@id' => $context->canonical . \WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH, |
|
168 | + ); |
|
169 | + } |
|
170 | + return $data; |
|
171 | + } |
|
172 | + /** |
|
173 | + * Generates the itemReviewed schema |
|
174 | + * |
|
175 | + * @param array $items The array of IDS. |
|
176 | + * @param string $type The schema type. |
|
177 | + * @return array $schema An array of the schema markup. |
|
178 | + */ |
|
179 | + public static function get_item_reviewed( $items = array(), $type = '' ) { |
|
180 | + $schema = array(); |
|
181 | + if ( false !== $items && ! empty( $items ) && '' !== $type ) { |
|
182 | + array_unique( $items ); |
|
183 | + foreach ( $items as $item ) { |
|
184 | + $title = get_the_title( $item ); |
|
185 | + if ( '' !== $title ) { |
|
186 | + $item_schema = array( |
|
187 | + '@type' => $type, |
|
188 | + 'name' => $title, |
|
189 | + ); |
|
190 | + $schema[] = $item_schema; |
|
191 | + } |
|
192 | + } |
|
193 | + } |
|
194 | + return $schema; |
|
195 | + } |
|
196 | + /** |
|
197 | + * Adds a term or multiple terms, comma separated, to a field. |
|
198 | + * |
|
199 | + * @param array $data Review data. |
|
200 | + * @param string $post_id The ID of the item to fetch terms. |
|
201 | + * @param string $key The key in data to save the terms in. |
|
202 | + * @param string $taxonomy The taxonomy to retrieve the terms from. |
|
203 | + * |
|
204 | + * @return mixed array $data Review data. |
|
205 | + */ |
|
206 | + public static function add_terms( $data, $post_id, $key, $taxonomy ) { |
|
207 | + $terms = get_the_terms( $post_id, $taxonomy ); |
|
208 | + if ( is_array( $terms ) ) { |
|
209 | + $keywords = array(); |
|
210 | + foreach ( $terms as $term ) { |
|
211 | + // We are checking against the WordPress internal translation. |
|
212 | + // @codingStandardsIgnoreLine |
|
213 | + if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) { |
|
214 | + $keywords[] = $term->name; |
|
215 | + } |
|
216 | + } |
|
217 | + $data[ $key ] = implode( ',', $keywords ); |
|
218 | + } |
|
219 | + return $data; |
|
220 | + } |
|
221 | 221 | } |
@@ -8,78 +8,78 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; |
|
11 | + exit; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
15 | - return; |
|
15 | + return; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if ( ! class_exists( 'LSX_Customize_Mobile_Header_Layout_Control' ) ) : |
19 | 19 | |
20 | - /** |
|
21 | - * LSX_Customize_Mobile_Header_Layout_Control Class |
|
22 | - * |
|
23 | - * @package lsx |
|
24 | - * @subpackage customizer |
|
25 | - * @category mobile-header-layout |
|
26 | - */ |
|
27 | - class LSX_Customize_Mobile_Header_Layout_Control extends WP_Customize_Control { |
|
20 | + /** |
|
21 | + * LSX_Customize_Mobile_Header_Layout_Control Class |
|
22 | + * |
|
23 | + * @package lsx |
|
24 | + * @subpackage customizer |
|
25 | + * @category mobile-header-layout |
|
26 | + */ |
|
27 | + class LSX_Customize_Mobile_Header_Layout_Control extends WP_Customize_Control { |
|
28 | 28 | |
29 | - public $type = 'layout'; |
|
30 | - public $statuses; |
|
31 | - public $layouts = array(); |
|
29 | + public $type = 'layout'; |
|
30 | + public $statuses; |
|
31 | + public $layouts = array(); |
|
32 | 32 | |
33 | - public function __construct( $manager, $id, $args = array() ) { |
|
34 | - parent::__construct( $manager, $id, $args ); |
|
33 | + public function __construct( $manager, $id, $args = array() ) { |
|
34 | + parent::__construct( $manager, $id, $args ); |
|
35 | 35 | |
36 | - if ( ! empty( $args['choices'] ) ) { |
|
37 | - $this->layouts = $args['choices']; |
|
38 | - } |
|
39 | - } |
|
36 | + if ( ! empty( $args['choices'] ) ) { |
|
37 | + $this->layouts = $args['choices']; |
|
38 | + } |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Enqueue scripts/styles for the color picker. |
|
43 | - */ |
|
44 | - public function enqueue() { |
|
45 | - wp_enqueue_script( 'lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
46 | - } |
|
41 | + /** |
|
42 | + * Enqueue scripts/styles for the color picker. |
|
43 | + */ |
|
44 | + public function enqueue() { |
|
45 | + wp_enqueue_script( 'lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Render output. |
|
50 | - */ |
|
51 | - public function render_content() { |
|
52 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
53 | - $class = 'customize-control customize-control-' . $this->type; |
|
54 | - $value = $this->value(); |
|
55 | - ?> |
|
48 | + /** |
|
49 | + * Render output. |
|
50 | + */ |
|
51 | + public function render_content() { |
|
52 | + $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
53 | + $class = 'customize-control customize-control-' . $this->type; |
|
54 | + $value = $this->value(); |
|
55 | + ?> |
|
56 | 56 | <label> |
57 | 57 | <?php |
58 | - if ( ! empty( $this->label ) ) { |
|
59 | - ?> |
|
58 | + if ( ! empty( $this->label ) ) { |
|
59 | + ?> |
|
60 | 60 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
61 | 61 | <?php |
62 | - } |
|
63 | - if ( ! empty( $this->description ) ) { |
|
64 | - ?> |
|
62 | + } |
|
63 | + if ( ! empty( $this->description ) ) { |
|
64 | + ?> |
|
65 | 65 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
66 | 66 | <?php } ?> |
67 | 67 | <div class="mobile-header-layouts-selector"> |
68 | 68 | <?php |
69 | - foreach ( $this->layouts as $layout ) { |
|
70 | - $sel = 'border: 1px solid transparent;'; |
|
71 | - if ( $value === $layout ) { |
|
72 | - $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
73 | - } |
|
74 | - echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
75 | - } |
|
76 | - ?> |
|
69 | + foreach ( $this->layouts as $layout ) { |
|
70 | + $sel = 'border: 1px solid transparent;'; |
|
71 | + if ( $value === $layout ) { |
|
72 | + $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
73 | + } |
|
74 | + echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
75 | + } |
|
76 | + ?> |
|
77 | 77 | <input <?php $this->link(); ?> class="selected-mobile-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
78 | 78 | </div> |
79 | 79 | </label> |
80 | 80 | <?php |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | endif; |