Completed
Push — master ( bf2bbf...a32fd1 )
by Fernando
02:51
created

functions.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * lsx functions and definitions
4
 *
5
 * @package lsx
6
 */
7
if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly
8
9
define('LSX_VERSION', '1.8.0');
10
11
require get_template_directory() . '/inc/config.php';
12
require get_template_directory() . '/inc/customizer.php';
13
require get_template_directory() . '/inc/sanitize.php';
14
require get_template_directory() . '/inc/layout.php';
15
require get_template_directory() . '/inc/hooks.php';
16
require get_template_directory() . '/inc/widgets.php';
17
require get_template_directory() . '/inc/scripts.php';
18
require get_template_directory() . '/inc/nav.php';
19
require get_template_directory() . '/inc/comment-walker.php';
20
require get_template_directory() . '/inc/jetpack.php';
21
require get_template_directory() . '/inc/lazyload.php';
22
if(class_exists('BuddyPress')){
23
	require get_template_directory() . '/inc/buddypress.php';
24
}
25
if(class_exists('WooCommerce')){
26
	require get_template_directory() . '/inc/woocommerce.php';
27
}
28
if(class_exists('WP_Job_Manager')){
29
	require get_template_directory() . '/inc/wp-job-manager.php';
30
}
31
if(class_exists('Tribe__Events__Main')){
32
	require get_template_directory() . '/inc/the-events-calendar.php';
33
}
34
require get_template_directory() . '/inc/template-tags.php';
35
require get_template_directory() . '/inc/extras.php';
36
require get_template_directory() . '/inc/wp-bootstrap-navwalker.php';
37
if(class_exists('Sensei_WC')){
38
	require get_template_directory() . '/inc/sensei.php';
39
}
40
41
/**
42
 * Returns an array of the core panel.
43
 *
44
 * @package 	lsx
45
 * @subpackage	functions
46
 * @category	customizer
47
 * @return		$lsx_controls array()
0 ignored issues
show
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
48
 */
49
function lsx_customizer_core_controls( $lsx_controls ) {
50
	$lsx_controls['sections']['lsx-core'] = array(
51
		'title'       =>  esc_html__( 'Core Settings', 'lsx' ),
52
		'description' => __( 'Change the core settings.', 'lsx' ),
53
		'priority'    => 21
54
	);
55
56
	$lsx_controls['settings']['lsx_lazyload_status'] = array(
57
		'default'           =>  '1',
58
		'sanitize_callback' => 'lsx_sanitize_checkbox',
59
		'transport'         =>  'postMessage',
60
	);
61
62
	$lsx_controls['fields']['lsx_lazyload_status'] = array(
63
		'label'         =>  __( 'Lazy Loading Images', 'lsx' ),
64
		'section'       =>  'lsx-core',
65
		'type'          =>  'checkbox',
66
	);
67
68
	$lsx_controls['settings']['lsx_preloader_content_status'] = array(
69
		'default'           =>  '1',
70
		'sanitize_callback' => 'lsx_sanitize_checkbox',
71
		'transport'         =>  'postMessage',
72
	);
73
74
	$lsx_controls['fields']['lsx_preloader_content_status'] = array(
75
		'label'         =>  __( 'Preloader Content', 'lsx' ),
76
		'section'       =>  'lsx-core',
77
		'type'          =>  'checkbox',
78
	);
79
80
	return $lsx_controls;
81
}
82
add_filter( 'lsx_customizer_controls', 'lsx_customizer_core_controls' );
83
84
/**
85
 * Returns an array of the layout panel.
86
 *
87
 * @package 	lsx
88
 * @subpackage	functions
89
 * @category	customizer
90
 * @return		$lsx_controls array()
0 ignored issues
show
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
91
 */
92
function lsx_customizer_layout_controls($lsx_controls) {
93
	$lsx_controls['settings']['lsx_header_layout']  = array(
94
			'default'       =>  'inline', //Default setting/value to save
95
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
96
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
97
	);
98
	$lsx_controls['fields']['lsx_header_layout'] = array(
99
			'label'         =>  __('Header','lsx'),
100
			'section'       =>  'lsx-layout',
101
			'control'   =>  'LSX_Customize_Header_Layout_Control',
102
			'choices'		=>	array('central','expanded','inline')
103
	);	
104
	$lsx_controls['sections']['lsx-layout'] = array(
105
			'title'       =>  esc_html__( 'Layout', 'lsx' ),
106
			'description' => __( 'Change the layout sitewide. If your homepage is set to use a page with a template, the following will not apply to it.', 'lsx' ),
107
			'priority' => 22
108
	);
109
	$lsx_controls['settings']['lsx_layout']  = array(
110
			'default'       =>  '2cr', //Default setting/value to save
111
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
112
			'transport'     =>  'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
113
	);
114
	$lsx_controls['settings']['lsx_header_fixed']  = array(
115
			'default'       =>  false, //Default setting/value to save
116
			'sanitize_callback' => 'lsx_sanitize_checkbox',
117
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
118
	);
119
	$lsx_controls['fields']['lsx_header_fixed'] = array(
120
			'label'         =>  __('Fixed Header','lsx'),
121
			'section'       =>  'lsx-layout',
122
			'type'       =>  'checkbox',
123
	);
124
	$lsx_controls['settings']['lsx_header_search']  = array(
125
			'default'       =>  false, //Default setting/value to save
126
			'sanitize_callback' => 'lsx_sanitize_checkbox',
127
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
128
	);
129
	$lsx_controls['fields']['lsx_header_search'] = array(
130
			'label'         =>  __('Search Box in Header','lsx'),
131
			'section'       =>  'lsx-layout',
132
			'type'       =>  'checkbox',
133
	);	
134
	$lsx_controls['fields']['lsx_layout'] = array(
135
			'label'         =>  __('Body','lsx'),
136
			'section'       =>  'lsx-layout',
137
			'control'   =>  'LSX_Customize_Layout_Control',
138
			'choices'		=>	array('1c','2cr','2cl')
139
	);	
140
	return $lsx_controls;
141
}
142
add_filter('lsx_customizer_controls','lsx_customizer_layout_controls');
143
144
/**
145
 * Returns an array of the font controls.
146
 *
147
 * @package 	lsx
148
 * @subpackage	functions
149
 * @category	customizer
150
 * @return		$lsx_controls array()
0 ignored issues
show
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
151
 */
152
function lsx_customizer_font_controls($lsx_controls) {
153
	$lsx_controls['sections']['lsx-font'] = array(
154
			'title'       =>  __( 'Font', 'lsx' ),
155
			'description' => 'Change the fonts sitewide.',
156
			'priority' => 41
157
	);
158
	$lsx_controls['settings']['lsx_font']  = array(
159
			'default'       =>  'raleway_open_sans', //Default setting/value to save
160
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
161
			'transport'     =>  'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
162
	);
163
	/// add the control
164
	$lsx_controls['fields']['lsx_font'] = array(
165
			'label'         =>  '',
166
			'section'       =>  'lsx-font',
167
			'settings'      =>  'lsx_font',
168
			'control'   =>  'LSX_Customize_Font_Control',
169
			'choices'   =>  array(
170
					'raleway_open_sans' => array(
171
							'header'  => array(
172
									"title" => __( 'Raleway', 'lsx' ),
173
									"location" => "Raleway",
174
									"cssDeclaration" => "'Raleway', sans-serif",
175
									"cssClass" => "raleway",
176
							),
177
							'body'  => array(
178
									"title" => __( 'Open Sans', 'lsx' ),
179
									"location" => "Open+Sans",
180
									"cssDeclaration" => "'Open Sans', sans-serif",
181
									"cssClass" => "openSans"
182
							),
183
					),
184
					'noto_serif_noto_sans' => array(
185
							'header'  => array(
186
									"title" => __( 'Noto Serif', 'lsx' ),
187
									"location" => "Noto+Serif",
188
									"cssDeclaration" => "'Noto Serif', serif",
189
									"cssClass" => "notoSerif",
190
							),
191
							'body'  => array(
192
									"title" => __( 'Noto Sans', 'lsx' ),
193
									"location" => "Noto+Sans",
194
									"cssDeclaration" => "'Noto Sans', sans-serif",
195
									"cssClass" => "notoSans",
196
							),
197
					),
198
					'noto_sans_noto_sans' => array(
199
					'header'  => array(
200
					"title" => __( 'Noto Sans', 'lsx' ),
201
					"location" => "Noto+Sans",
202
					"cssDeclaration" => "'Noto Sans', sans-serif",
203
					"cssClass" => "notoSans",
204
					),
205
					'body'  => array(
206
					"title" => __( 'Noto Sans', 'lsx' ),
207
					"location" => "Noto+Sans",
208
					"cssDeclaration" => "'Noto Sans', sans-serif",
209
					"cssClass" => "notoSans",
210
					),
211
					),
212
					'alegreya_open_sans' => array(
213
					'header'  => array(
214
					"title" => __( 'Alegreya', 'lsx' ),
215
					"location" => "Alegreya",
216
					"cssDeclaration" => "'Alegreya', serif",
217
					"cssClass" => "alegreya",
218
					),
219
					'body'  => array(
220
					"title" => __( 'Open Sans', 'lsx' ),
221
					"location" => "Open+Sans",
222
					"cssDeclaration" => "'Open Sans', sans-serif",
223
					"cssClass" => "openSans"
224
							),
225
					),
226
			),
227
			'priority' => 2,
228
	);	
229
	return $lsx_controls;
230
}
231
add_filter('lsx_customizer_controls','lsx_customizer_font_controls');
232
233
/**
234
 * Returns an array of $controls for the customizer class to generate.
235
 *
236
 * @package 	lsx
237
 * @subpackage	functions
238
 * @category	customizer
239
 * @return		$lsx_controls array()
0 ignored issues
show
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
240
 */
241
function lsx_get_customizer_controls(){
242
	$lsx_controls = array();
243
	$lsx_controls = apply_filters('lsx_customizer_controls', $lsx_controls);
244
	return $lsx_controls;
245
}
246
$lsx_customizer = new LSX_Theme_Customizer( lsx_get_customizer_controls() );
247
248
add_image_size( 'lsx-thumbnail-wide', 350, 230, true );
249
add_image_size( 'lsx-thumbnail-single', 750, 350, true );