@@ -1,103 +1,103 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Footer_CTA' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Colour Footer CTA Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Colour_Footer_CTA extends LSX_Customizer_Colour { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | - |
|
24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Assign CSS to theme mod. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public function set_theme_mod() { |
|
33 | - $theme_mods = $this->get_theme_mods(); |
|
34 | - $styles = $this->get_css( $theme_mods ); |
|
35 | - |
|
36 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Enqueues front-end CSS. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - */ |
|
44 | - public function enqueue_css() { |
|
45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod' ); |
|
46 | - |
|
47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | - $theme_mods = $this->get_theme_mods(); |
|
49 | - $styles = $this->get_css( $theme_mods ); |
|
50 | - |
|
51 | - if ( false === $styles_from_theme_mod ) { |
|
52 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
53 | - } |
|
54 | - } else { |
|
55 | - $styles = $styles_from_theme_mod; |
|
56 | - } |
|
57 | - |
|
58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get CSS theme mods. |
|
63 | - * |
|
64 | - * @since 1.0.0 |
|
65 | - */ |
|
66 | - public function get_theme_mods() { |
|
67 | - $colors = parent::get_color_scheme(); |
|
68 | - |
|
69 | - return apply_filters( 'lsx_customizer_colours_footer_cta', array( |
|
70 | - 'footer_cta_background_color' => get_theme_mod( 'footer_cta_background_color', $colors['footer_cta_background_color'] ), |
|
71 | - 'footer_cta_text_color' => get_theme_mod( 'footer_cta_text_color', $colors['footer_cta_text_color'] ), |
|
72 | - 'footer_cta_link_color' => get_theme_mod( 'footer_cta_link_color', $colors['footer_cta_link_color'] ), |
|
73 | - 'footer_cta_link_hover_color' => get_theme_mod( 'footer_cta_link_hover_color', $colors['footer_cta_link_hover_color'] ), |
|
74 | - ) ); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Returns CSS. |
|
79 | - * |
|
80 | - * @since 1.0.0 |
|
81 | - */ |
|
82 | - function get_css( $colors ) { |
|
83 | - global $customizer_colour_names; |
|
84 | - |
|
85 | - $colors_template = array(); |
|
86 | - |
|
87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
88 | - $colors_template[ $key ] = ''; |
|
89 | - } |
|
90 | - |
|
91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
92 | - |
|
93 | - if ( empty( $colors['footer_cta_background_color'] ) |
|
94 | - || empty( $colors['footer_cta_text_color'] ) |
|
95 | - || empty( $colors['footer_cta_link_color'] ) |
|
96 | - || empty( $colors['footer_cta_link_hover_color'] ) ) { |
|
97 | - return ''; |
|
98 | - } |
|
99 | - |
|
100 | - $css = ' |
|
4 | + /** |
|
5 | + * LSX Customizer Colour Footer CTA Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Colour_Footer_CTA extends LSX_Customizer_Colour { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | + |
|
24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Assign CSS to theme mod. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public function set_theme_mod() { |
|
33 | + $theme_mods = $this->get_theme_mods(); |
|
34 | + $styles = $this->get_css( $theme_mods ); |
|
35 | + |
|
36 | + set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Enqueues front-end CSS. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + */ |
|
44 | + public function enqueue_css() { |
|
45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod' ); |
|
46 | + |
|
47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | + $theme_mods = $this->get_theme_mods(); |
|
49 | + $styles = $this->get_css( $theme_mods ); |
|
50 | + |
|
51 | + if ( false === $styles_from_theme_mod ) { |
|
52 | + set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
53 | + } |
|
54 | + } else { |
|
55 | + $styles = $styles_from_theme_mod; |
|
56 | + } |
|
57 | + |
|
58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get CSS theme mods. |
|
63 | + * |
|
64 | + * @since 1.0.0 |
|
65 | + */ |
|
66 | + public function get_theme_mods() { |
|
67 | + $colors = parent::get_color_scheme(); |
|
68 | + |
|
69 | + return apply_filters( 'lsx_customizer_colours_footer_cta', array( |
|
70 | + 'footer_cta_background_color' => get_theme_mod( 'footer_cta_background_color', $colors['footer_cta_background_color'] ), |
|
71 | + 'footer_cta_text_color' => get_theme_mod( 'footer_cta_text_color', $colors['footer_cta_text_color'] ), |
|
72 | + 'footer_cta_link_color' => get_theme_mod( 'footer_cta_link_color', $colors['footer_cta_link_color'] ), |
|
73 | + 'footer_cta_link_hover_color' => get_theme_mod( 'footer_cta_link_hover_color', $colors['footer_cta_link_hover_color'] ), |
|
74 | + ) ); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Returns CSS. |
|
79 | + * |
|
80 | + * @since 1.0.0 |
|
81 | + */ |
|
82 | + function get_css( $colors ) { |
|
83 | + global $customizer_colour_names; |
|
84 | + |
|
85 | + $colors_template = array(); |
|
86 | + |
|
87 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
88 | + $colors_template[ $key ] = ''; |
|
89 | + } |
|
90 | + |
|
91 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
92 | + |
|
93 | + if ( empty( $colors['footer_cta_background_color'] ) |
|
94 | + || empty( $colors['footer_cta_text_color'] ) |
|
95 | + || empty( $colors['footer_cta_link_color'] ) |
|
96 | + || empty( $colors['footer_cta_link_hover_color'] ) ) { |
|
97 | + return ''; |
|
98 | + } |
|
99 | + |
|
100 | + $css = ' |
|
101 | 101 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/footer-cta"; |
102 | 102 | |
103 | 103 | /** |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | ); |
112 | 112 | '; |
113 | 113 | |
114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer_cta', $css, $colors ); |
|
115 | - $css = parent::scss_to_css( $css ); |
|
116 | - return $css; |
|
117 | - } |
|
114 | + $css = apply_filters( 'lsx_customizer_colour_selectors_footer_cta', $css, $colors ); |
|
115 | + $css = parent::scss_to_css( $css ); |
|
116 | + return $css; |
|
117 | + } |
|
118 | 118 | |
119 | - } |
|
119 | + } |
|
120 | 120 | |
121 | 121 | } |
@@ -1,103 +1,103 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Footer_Widgets' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Colour Footer Widgets Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Colour_Footer_Widgets extends LSX_Customizer_Colour { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | - |
|
24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Assign CSS to theme mod. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public function set_theme_mod() { |
|
33 | - $theme_mods = $this->get_theme_mods(); |
|
34 | - $styles = $this->get_css( $theme_mods ); |
|
35 | - |
|
36 | - set_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod', $styles ); |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Enqueues front-end CSS. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - */ |
|
44 | - public function enqueue_css() { |
|
45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod' ); |
|
46 | - |
|
47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | - $theme_mods = $this->get_theme_mods(); |
|
49 | - $styles = $this->get_css( $theme_mods ); |
|
50 | - |
|
51 | - if ( false === $styles_from_theme_mod ) { |
|
52 | - set_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod', $styles ); |
|
53 | - } |
|
54 | - } else { |
|
55 | - $styles = $styles_from_theme_mod; |
|
56 | - } |
|
57 | - |
|
58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get CSS theme mods. |
|
63 | - * |
|
64 | - * @since 1.0.0 |
|
65 | - */ |
|
66 | - public function get_theme_mods() { |
|
67 | - $colors = parent::get_color_scheme(); |
|
68 | - |
|
69 | - return apply_filters( 'lsx_customizer_colours_footer_widgets', array( |
|
70 | - 'footer_widgets_background_color' => get_theme_mod( 'footer_widgets_background_color', $colors['footer_widgets_background_color'] ), |
|
71 | - 'footer_widgets_text_color' => get_theme_mod( 'footer_widgets_text_color', $colors['footer_widgets_text_color'] ), |
|
72 | - 'footer_widgets_link_color' => get_theme_mod( 'footer_widgets_link_color', $colors['footer_widgets_link_color'] ), |
|
73 | - 'footer_widgets_link_hover_color' => get_theme_mod( 'footer_widgets_link_hover_color', $colors['footer_widgets_link_hover_color'] ), |
|
74 | - ) ); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Returns CSS. |
|
79 | - * |
|
80 | - * @since 1.0.0 |
|
81 | - */ |
|
82 | - function get_css( $colors ) { |
|
83 | - global $customizer_colour_names; |
|
84 | - |
|
85 | - $colors_template = array(); |
|
86 | - |
|
87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
88 | - $colors_template[ $key ] = ''; |
|
89 | - } |
|
90 | - |
|
91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
92 | - |
|
93 | - if ( empty( $colors['footer_widgets_background_color'] ) |
|
94 | - || empty( $colors['footer_widgets_text_color'] ) |
|
95 | - || empty( $colors['footer_widgets_link_color'] ) |
|
96 | - || empty( $colors['footer_widgets_link_hover_color'] ) ) { |
|
97 | - return ''; |
|
98 | - } |
|
99 | - |
|
100 | - $css = ' |
|
4 | + /** |
|
5 | + * LSX Customizer Colour Footer Widgets Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Colour_Footer_Widgets extends LSX_Customizer_Colour { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | + |
|
24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Assign CSS to theme mod. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public function set_theme_mod() { |
|
33 | + $theme_mods = $this->get_theme_mods(); |
|
34 | + $styles = $this->get_css( $theme_mods ); |
|
35 | + |
|
36 | + set_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod', $styles ); |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Enqueues front-end CSS. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + */ |
|
44 | + public function enqueue_css() { |
|
45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod' ); |
|
46 | + |
|
47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | + $theme_mods = $this->get_theme_mods(); |
|
49 | + $styles = $this->get_css( $theme_mods ); |
|
50 | + |
|
51 | + if ( false === $styles_from_theme_mod ) { |
|
52 | + set_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod', $styles ); |
|
53 | + } |
|
54 | + } else { |
|
55 | + $styles = $styles_from_theme_mod; |
|
56 | + } |
|
57 | + |
|
58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get CSS theme mods. |
|
63 | + * |
|
64 | + * @since 1.0.0 |
|
65 | + */ |
|
66 | + public function get_theme_mods() { |
|
67 | + $colors = parent::get_color_scheme(); |
|
68 | + |
|
69 | + return apply_filters( 'lsx_customizer_colours_footer_widgets', array( |
|
70 | + 'footer_widgets_background_color' => get_theme_mod( 'footer_widgets_background_color', $colors['footer_widgets_background_color'] ), |
|
71 | + 'footer_widgets_text_color' => get_theme_mod( 'footer_widgets_text_color', $colors['footer_widgets_text_color'] ), |
|
72 | + 'footer_widgets_link_color' => get_theme_mod( 'footer_widgets_link_color', $colors['footer_widgets_link_color'] ), |
|
73 | + 'footer_widgets_link_hover_color' => get_theme_mod( 'footer_widgets_link_hover_color', $colors['footer_widgets_link_hover_color'] ), |
|
74 | + ) ); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Returns CSS. |
|
79 | + * |
|
80 | + * @since 1.0.0 |
|
81 | + */ |
|
82 | + function get_css( $colors ) { |
|
83 | + global $customizer_colour_names; |
|
84 | + |
|
85 | + $colors_template = array(); |
|
86 | + |
|
87 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
88 | + $colors_template[ $key ] = ''; |
|
89 | + } |
|
90 | + |
|
91 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
92 | + |
|
93 | + if ( empty( $colors['footer_widgets_background_color'] ) |
|
94 | + || empty( $colors['footer_widgets_text_color'] ) |
|
95 | + || empty( $colors['footer_widgets_link_color'] ) |
|
96 | + || empty( $colors['footer_widgets_link_hover_color'] ) ) { |
|
97 | + return ''; |
|
98 | + } |
|
99 | + |
|
100 | + $css = ' |
|
101 | 101 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/footer-widgets"; |
102 | 102 | |
103 | 103 | /** |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | ); |
112 | 112 | '; |
113 | 113 | |
114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer_widgets', $css, $colors ); |
|
115 | - $css = parent::scss_to_css( $css ); |
|
114 | + $css = apply_filters( 'lsx_customizer_colour_selectors_footer_widgets', $css, $colors ); |
|
115 | + $css = parent::scss_to_css( $css ); |
|
116 | 116 | |
117 | - return $css; |
|
118 | - } |
|
117 | + return $css; |
|
118 | + } |
|
119 | 119 | |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | } |
@@ -1,526 +1,526 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Login' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Login Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2019 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Login extends LSX_Customizer { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'customize_register', array( $this, 'register_general' ), 20 ); |
|
22 | - add_action( 'customize_register', array( $this, 'register_form' ), 30 ); |
|
23 | - add_action( 'customize_register', array( $this, 'register_background' ), 40 ); |
|
24 | - |
|
25 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
26 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
27 | - add_action( 'login_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
28 | - } |
|
29 | - |
|
30 | - /** |
|
31 | - * Customizer Controls and Settings. |
|
32 | - * |
|
33 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
34 | - * @since 1.0.0 |
|
35 | - */ |
|
36 | - public function register_general( $wp_customize ) { |
|
37 | - /** |
|
38 | - * Register the main panel |
|
39 | - */ |
|
40 | - $wp_customize->add_panel( |
|
41 | - 'login', |
|
42 | - array( |
|
43 | - 'title' => esc_html__( 'WP Login Screen', 'lsx-customizer' ), |
|
44 | - 'priority' => 60, |
|
45 | - ) |
|
46 | - ); |
|
47 | - |
|
48 | - /** |
|
49 | - * Reigster the Form section |
|
50 | - */ |
|
51 | - $wp_customize->add_section( |
|
52 | - 'login-general', |
|
53 | - array( |
|
54 | - 'title' => esc_html__( 'General', 'lsx-customizer' ), |
|
55 | - 'priority' => 1, |
|
56 | - 'panel' => 'login', |
|
57 | - ) |
|
58 | - ); |
|
59 | - |
|
60 | - /** |
|
61 | - * Select the background repeat. |
|
62 | - */ |
|
63 | - $wp_customize->add_setting( |
|
64 | - 'lsx_login_logo', |
|
65 | - array( |
|
66 | - 'default' => '', |
|
67 | - 'type' => 'theme_mod', |
|
68 | - 'transport' => 'postMessage', |
|
69 | - ) |
|
70 | - ); |
|
71 | - |
|
72 | - $wp_customize->add_control( |
|
73 | - new WP_Customize_Image_Control( |
|
74 | - $wp_customize, |
|
75 | - 'lsx_login_logo', |
|
76 | - array( |
|
77 | - 'label' => __( 'Upload a logo', 'lsx-customizer' ), |
|
78 | - 'section' => 'login-general', |
|
79 | - 'settings' => 'lsx_login_logo', |
|
80 | - ) |
|
81 | - ) |
|
82 | - ); |
|
83 | - |
|
84 | - /** |
|
85 | - * Link Colour |
|
86 | - */ |
|
87 | - $wp_customize->add_setting( |
|
88 | - 'lsx_login_link_colour', |
|
89 | - array( |
|
90 | - 'default' => '0085ba', |
|
91 | - 'type' => 'theme_mod', |
|
92 | - 'transport' => 'postMessage', |
|
93 | - ) |
|
94 | - ); |
|
95 | - $wp_customize->add_control( |
|
96 | - new WP_Customize_Color_Control( |
|
97 | - $wp_customize, |
|
98 | - 'lsx_login_link_colour', |
|
99 | - array( |
|
100 | - 'label' => __( 'Link Colour', 'lsx-customizer' ), |
|
101 | - 'section' => 'login-general', |
|
102 | - 'settings' => 'lsx_login_link_colour', |
|
103 | - ) |
|
104 | - ) |
|
105 | - ); |
|
106 | - |
|
107 | - /** |
|
108 | - * Link Hover Colour |
|
109 | - */ |
|
110 | - $wp_customize->add_setting( |
|
111 | - 'lsx_login_link_hover_colour', |
|
112 | - array( |
|
113 | - 'default' => '000000', |
|
114 | - 'type' => 'theme_mod', |
|
115 | - 'transport' => 'postMessage', |
|
116 | - ) |
|
117 | - ); |
|
118 | - $wp_customize->add_control( |
|
119 | - new WP_Customize_Color_Control( |
|
120 | - $wp_customize, |
|
121 | - 'lsx_login_link_hover_colour', |
|
122 | - array( |
|
123 | - 'label' => __( 'Link Hover Colour', 'lsx-customizer' ), |
|
124 | - 'section' => 'login-general', |
|
125 | - 'settings' => 'lsx_login_link_hover_colour', |
|
126 | - ) |
|
127 | - ) |
|
128 | - ); |
|
129 | - |
|
130 | - /** |
|
131 | - * Add in the custom CSS. |
|
132 | - */ |
|
133 | - $wp_customize->add_setting( |
|
134 | - 'lsx_login_custom_css', |
|
135 | - array( |
|
136 | - 'default' => '', |
|
137 | - 'type' => 'theme_mod', |
|
138 | - 'transport' => 'postMessage', |
|
139 | - ) |
|
140 | - ); |
|
141 | - $wp_customize->add_control( |
|
142 | - new WP_Customize_Control( |
|
143 | - $wp_customize, |
|
144 | - 'lsx_login_custom_css', |
|
145 | - array( |
|
146 | - 'label' => __( 'Custom CSS', 'lsx-customizer' ), |
|
147 | - 'section' => 'login-general', |
|
148 | - 'settings' => 'lsx_login_custom_css', |
|
149 | - 'type' => 'textarea', |
|
150 | - ) |
|
151 | - ) |
|
152 | - ); |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Customizer Controls and Settings. |
|
157 | - * |
|
158 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
159 | - * @since 1.0.0 |
|
160 | - */ |
|
161 | - public function register_form( $wp_customize ) { |
|
162 | - /** |
|
163 | - * Reigster the Form section |
|
164 | - */ |
|
165 | - $wp_customize->add_section( |
|
166 | - 'login-form', |
|
167 | - array( |
|
168 | - 'title' => esc_html__( 'Form', 'lsx-customizer' ), |
|
169 | - 'priority' => 1, |
|
170 | - 'panel' => 'login', |
|
171 | - ) |
|
172 | - ); |
|
173 | - |
|
174 | - /** |
|
175 | - * Form Background Colour |
|
176 | - */ |
|
177 | - $wp_customize->add_setting( |
|
178 | - 'lsx_login_form_colour', |
|
179 | - array( |
|
180 | - 'default' => 'ffffff', |
|
181 | - 'type' => 'theme_mod', |
|
182 | - 'transport' => 'postMessage', |
|
183 | - ) |
|
184 | - ); |
|
185 | - $wp_customize->add_control( |
|
186 | - new WP_Customize_Color_Control( |
|
187 | - $wp_customize, |
|
188 | - 'lsx_login_form_colour', |
|
189 | - array( |
|
190 | - 'label' => __( 'Form Background Color', 'lsx-customizer' ), |
|
191 | - 'section' => 'login-form', |
|
192 | - 'settings' => 'lsx_login_form_colour', |
|
193 | - ) |
|
194 | - ) |
|
195 | - ); |
|
196 | - |
|
197 | - /** |
|
198 | - * Form Label Colour |
|
199 | - */ |
|
200 | - $wp_customize->add_setting( |
|
201 | - 'lsx_login_form_label_colour', |
|
202 | - array( |
|
203 | - 'default' => 'ffffff', |
|
204 | - 'type' => 'theme_mod', |
|
205 | - 'transport' => 'postMessage', |
|
206 | - ) |
|
207 | - ); |
|
208 | - $wp_customize->add_control( |
|
209 | - new WP_Customize_Color_Control( |
|
210 | - $wp_customize, |
|
211 | - 'lsx_login_form_label_colour', |
|
212 | - array( |
|
213 | - 'label' => __( 'Form Label Color', 'lsx-customizer' ), |
|
214 | - 'section' => 'login-form', |
|
215 | - 'settings' => 'lsx_login_form_label_colour', |
|
216 | - ) |
|
217 | - ) |
|
218 | - ); |
|
219 | - |
|
220 | - /** |
|
221 | - * Button Color |
|
222 | - */ |
|
223 | - $wp_customize->add_setting( |
|
224 | - 'lsx_login_button_colour', |
|
225 | - array( |
|
226 | - 'default' => '000000', |
|
227 | - 'type' => 'theme_mod', |
|
228 | - 'transport' => 'postMessage', |
|
229 | - ) |
|
230 | - ); |
|
231 | - $wp_customize->add_control( |
|
232 | - new WP_Customize_Color_Control( |
|
233 | - $wp_customize, |
|
234 | - 'lsx_login_button_colour', |
|
235 | - array( |
|
236 | - 'label' => __( 'Button Colour', 'lsx-customizer' ), |
|
237 | - 'section' => 'login-form', |
|
238 | - 'settings' => 'lsx_login_button_colour', |
|
239 | - ) |
|
240 | - ) |
|
241 | - ); |
|
242 | - |
|
243 | - /** |
|
244 | - * Button Shadow Color |
|
245 | - */ |
|
246 | - $wp_customize->add_setting( |
|
247 | - 'lsx_login_button_shadow_colour', |
|
248 | - array( |
|
249 | - 'default' => '015d82', |
|
250 | - 'type' => 'theme_mod', |
|
251 | - 'transport' => 'postMessage', |
|
252 | - ) |
|
253 | - ); |
|
254 | - $wp_customize->add_control( |
|
255 | - new WP_Customize_Color_Control( |
|
256 | - $wp_customize, |
|
257 | - 'lsx_login_button_shadow_colour', |
|
258 | - array( |
|
259 | - 'label' => __( 'Button Shadow Colour', 'lsx-customizer' ), |
|
260 | - 'section' => 'login-form', |
|
261 | - 'settings' => 'lsx_login_button_shadow_colour', |
|
262 | - ) |
|
263 | - ) |
|
264 | - ); |
|
265 | - |
|
266 | - /** |
|
267 | - * Button Hover Color |
|
268 | - */ |
|
269 | - $wp_customize->add_setting( |
|
270 | - 'lsx_login_button_hover_colour', |
|
271 | - array( |
|
272 | - 'default' => '000000', |
|
273 | - 'type' => 'theme_mod', |
|
274 | - 'transport' => 'postMessage', |
|
275 | - ) |
|
276 | - ); |
|
277 | - $wp_customize->add_control( |
|
278 | - new WP_Customize_Color_Control( |
|
279 | - $wp_customize, |
|
280 | - 'lsx_login_button_hover_colour', |
|
281 | - array( |
|
282 | - 'label' => __( 'Button Hover Colour', 'lsx-customizer' ), |
|
283 | - 'section' => 'login-form', |
|
284 | - 'settings' => 'lsx_login_button_hover_colour', |
|
285 | - ) |
|
286 | - ) |
|
287 | - ); |
|
288 | - |
|
289 | - /** |
|
290 | - * Button Text Colour |
|
291 | - */ |
|
292 | - $wp_customize->add_setting( |
|
293 | - 'lsx_login_button_text_colour', |
|
294 | - array( |
|
295 | - 'default' => '0085ba', |
|
296 | - 'type' => 'theme_mod', |
|
297 | - 'transport' => 'postMessage', |
|
298 | - ) |
|
299 | - ); |
|
300 | - $wp_customize->add_control( |
|
301 | - new WP_Customize_Color_Control( |
|
302 | - $wp_customize, |
|
303 | - 'lsx_login_button_text_colour', |
|
304 | - array( |
|
305 | - 'label' => __( 'Button Text Colour', 'lsx-customizer' ), |
|
306 | - 'section' => 'login-form', |
|
307 | - 'settings' => 'lsx_login_button_text_colour', |
|
308 | - ) |
|
309 | - ) |
|
310 | - ); |
|
311 | - |
|
312 | - } |
|
313 | - |
|
314 | - /** |
|
315 | - * Customizer Controls and Settings. |
|
316 | - * |
|
317 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
318 | - * @since 1.0.0 |
|
319 | - */ |
|
320 | - public function register_background( $wp_customize ) { |
|
321 | - $wp_customize->add_section( |
|
322 | - 'login-background', |
|
323 | - array( |
|
324 | - 'title' => esc_html__( 'Background', 'lsx-customizer' ), |
|
325 | - 'priority' => 1, |
|
326 | - 'panel' => 'login', |
|
327 | - ) |
|
328 | - ); |
|
329 | - /** |
|
330 | - * Background Colour |
|
331 | - */ |
|
332 | - $wp_customize->add_setting( |
|
333 | - 'lsx_login_bg_colour', |
|
334 | - array( |
|
335 | - 'default' => 'ffffff', |
|
336 | - 'type' => 'theme_mod', |
|
337 | - 'transport' => 'postMessage', |
|
338 | - ) |
|
339 | - ); |
|
340 | - $wp_customize->add_control( |
|
341 | - new WP_Customize_Color_Control( |
|
342 | - $wp_customize, |
|
343 | - 'lsx_login_bg_colour', |
|
344 | - array( |
|
345 | - 'label' => __( 'Background Colour', 'lsx-customizer' ), |
|
346 | - 'section' => 'login-background', |
|
347 | - 'settings' => 'lsx_login_bg_colour', |
|
348 | - ) |
|
349 | - ) |
|
350 | - ); |
|
351 | - |
|
352 | - /** |
|
353 | - * Upload a Background Image |
|
354 | - */ |
|
355 | - $wp_customize->add_setting( |
|
356 | - 'lsx_login_bg_image', |
|
357 | - array( |
|
358 | - 'default' => '', |
|
359 | - 'type' => 'theme_mod', |
|
360 | - 'transport' => 'postMessage', |
|
361 | - ) |
|
362 | - ); |
|
363 | - |
|
364 | - $wp_customize->add_control( |
|
365 | - new WP_Customize_Image_Control( |
|
366 | - $wp_customize, |
|
367 | - 'lsx_login_bg_image', |
|
368 | - array( |
|
369 | - 'label' => __( 'Background Image', 'lsx-customizer' ), |
|
370 | - 'section' => 'login-background', |
|
371 | - 'settings' => 'lsx_login_bg_image', |
|
372 | - ) |
|
373 | - ) |
|
374 | - ); |
|
375 | - |
|
376 | - /** |
|
377 | - * Select the background repeat. |
|
378 | - */ |
|
379 | - $wp_customize->add_setting( |
|
380 | - 'lsx_login_bg_repeat', |
|
381 | - array( |
|
382 | - 'default' => 'no-repeat', |
|
383 | - 'type' => 'theme_mod', |
|
384 | - 'transport' => 'postMessage', |
|
385 | - ) |
|
386 | - ); |
|
387 | - $wp_customize->add_control( |
|
388 | - new WP_Customize_Control( |
|
389 | - $wp_customize, |
|
390 | - 'lsx_login_bg_repeat', |
|
391 | - array( |
|
392 | - 'label' => __( 'Background Repeat', 'lsx-customizer' ), |
|
393 | - 'section' => 'login-background', |
|
394 | - 'settings' => 'lsx_login_bg_repeat', |
|
395 | - 'type' => 'select', |
|
396 | - 'choices' => array( |
|
397 | - 'no-repeat' => __( 'No Repeat', 'lsx-customizer' ), |
|
398 | - 'repeat' => __( 'Repeat', 'lsx-customizer' ), |
|
399 | - 'repeat-x' => __( 'Repeat Horizontally', 'lsx-customizer' ), |
|
400 | - 'repeat-y' => __( 'Repeat Vertically', 'lsx-customizer' ), |
|
401 | - ), |
|
402 | - ) |
|
403 | - ) |
|
404 | - ); |
|
405 | - |
|
406 | - /** |
|
407 | - * Select the background repeat. |
|
408 | - */ |
|
409 | - $wp_customize->add_setting( |
|
410 | - 'lsx_login_bg_size', |
|
411 | - array( |
|
412 | - 'default' => 'none', |
|
413 | - 'type' => 'theme_mod', |
|
414 | - 'transport' => 'postMessage', |
|
415 | - ) |
|
416 | - ); |
|
417 | - $wp_customize->add_control( |
|
418 | - new WP_Customize_Control( |
|
419 | - $wp_customize, |
|
420 | - 'lsx_login_bg_size', |
|
421 | - array( |
|
422 | - 'label' => __( 'Background Size', 'lsx-customizer' ), |
|
423 | - 'section' => 'login-background', |
|
424 | - 'settings' => 'lsx_login_bg_size', |
|
425 | - 'type' => 'select', |
|
426 | - 'choices' => array( |
|
427 | - 'initial' => __( 'None', 'lsx-customizer' ), |
|
428 | - 'cover' => __( 'Cover', 'lsx-customizer' ), |
|
429 | - 'contain' => __( 'Contain', 'lsx-customizer' ), |
|
430 | - ), |
|
431 | - ) |
|
432 | - ) |
|
433 | - ); |
|
434 | - } |
|
435 | - |
|
436 | - /** |
|
437 | - * Assign CSS to theme mod. |
|
438 | - * |
|
439 | - * @since 1.0.0 |
|
440 | - */ |
|
441 | - public function set_theme_mod() { |
|
442 | - $theme_mods = $this->get_theme_mods(); |
|
443 | - $styles = $this->get_css( $theme_mods ); |
|
444 | - |
|
445 | - set_theme_mod( 'lsx_customizer_login_styles', $styles ); |
|
446 | - } |
|
447 | - |
|
448 | - /** |
|
449 | - * Enqueues front-end CSS. |
|
450 | - * |
|
451 | - * @since 1.0.0 |
|
452 | - */ |
|
453 | - public function enqueue_css() { |
|
454 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_login_styles' ); |
|
455 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
456 | - $theme_mods = $this->get_theme_mods(); |
|
457 | - $styles = $this->get_css( $theme_mods ); |
|
458 | - |
|
459 | - if ( false === $styles_from_theme_mod ) { |
|
460 | - set_theme_mod( 'lsx_customizer_login_styles', $styles ); |
|
461 | - } |
|
462 | - } else { |
|
463 | - $styles = $styles_from_theme_mod; |
|
464 | - } |
|
465 | - echo wp_kses( |
|
466 | - $styles, |
|
467 | - array( |
|
468 | - 'style' => array(), |
|
469 | - ) |
|
470 | - ); |
|
471 | - } |
|
472 | - |
|
473 | - /** |
|
474 | - * Get CSS theme mods. |
|
475 | - * |
|
476 | - * @since 1.0.0 |
|
477 | - */ |
|
478 | - public function get_theme_mods() { |
|
479 | - $mods = apply_filters( |
|
480 | - 'lsx_customizer_login_styles', |
|
481 | - array( |
|
482 | - 'logo' => get_theme_mod( 'lsx_login_logo', '' ), |
|
483 | - 'link_colour' => get_theme_mod( 'lsx_login_link_colour', '#0085ba' ), |
|
484 | - 'link_hover_colour' => get_theme_mod( 'lsx_login_link_hover_colour', '#0085ba' ), |
|
485 | - 'button_colour' => get_theme_mod( 'lsx_login_button_colour', '#0085ba' ), |
|
486 | - 'button_shadow_colour' => get_theme_mod( 'lsx_login_button_shadow_colour', '#015d82' ), |
|
487 | - 'button_hover_colour' => get_theme_mod( 'lsx_login_button_hover_colour', '#015d82' ), |
|
488 | - 'button_text_colour' => get_theme_mod( 'lsx_login_button_text_colour', '#ffffff' ), |
|
489 | - 'login_form_colour' => get_theme_mod( 'lsx_login_form_colour', '#ffffff' ), |
|
490 | - 'login_form_label_colour' => get_theme_mod( 'lsx_login_form_label_colour', '#333333' ), |
|
491 | - 'background_colour' => get_theme_mod( 'lsx_login_bg_colour', '#f2f2f2' ), |
|
492 | - 'background_image' => get_theme_mod( 'lsx_login_bg_image', '' ), |
|
493 | - 'background_repeat' => get_theme_mod( 'lsx_login_bg_repeat', 'no-repeat' ), |
|
494 | - 'background_size' => get_theme_mod( 'lsx_login_bg_size', 'initial' ), |
|
495 | - 'custom_css' => get_theme_mod( 'lsx_login_custom_css', '' ), |
|
496 | - ) |
|
497 | - ); |
|
498 | - return $mods; |
|
499 | - } |
|
500 | - |
|
501 | - /** |
|
502 | - * Returns CSS. |
|
503 | - * |
|
504 | - * @since 1.0.0 |
|
505 | - */ |
|
506 | - public function get_css( $theme_mods ) { |
|
507 | - $css = '<style>'; |
|
508 | - |
|
509 | - $css .= "body.login #backtoblog a, body.login #nav a { color: {$theme_mods['link_colour']}; }"; |
|
510 | - $css .= "body.login #nav a:hover, .login h1 a:hover, body.login #backtoblog a:hover { color: {$theme_mods['link_hover_colour']}; }"; |
|
511 | - $css .= "body.login.wp-core-ui .button-primary { background-color: {$theme_mods['button_colour']}; }"; |
|
512 | - $css .= "body.login.wp-core-ui .button-primary { border-color: {$theme_mods['button_colour']}; }"; |
|
513 | - $css .= "body.login.wp-core-ui .button-primary:hover { background-color: {$theme_mods['button_hover_colour']}; }"; |
|
514 | - $css .= "body.login.wp-core-ui .button-primary:hover { border-color: {$theme_mods['button_hover_colour']}; }"; |
|
515 | - $css .= "body.login .button-primary { box-shadow: 0 1px 0 {$theme_mods['button_shadow_colour']}; }"; |
|
516 | - $css .= "body.login .button-primary:active { box-shadow: 0 2px 0 {$theme_mods['button_shadow_colour']}; }"; |
|
517 | - $css .= "body.login .button-primary { color: {$theme_mods['button_text_colour']} ; }"; |
|
518 | - $css .= 'body.login .button-primary { text-shadow: none; }'; |
|
519 | - $css .= "body.login form { background: {$theme_mods['login_form_colour']}; }"; |
|
520 | - $css .= "body.login label { color: {$theme_mods['login_form_label_colour']}; }"; |
|
521 | - |
|
522 | - if ( isset( $theme_mods['logo'] ) && '' !== $theme_mods['logo'] ) { |
|
523 | - $css .= " |
|
4 | + /** |
|
5 | + * LSX Customizer Login Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2019 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Login extends LSX_Customizer { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'customize_register', array( $this, 'register_general' ), 20 ); |
|
22 | + add_action( 'customize_register', array( $this, 'register_form' ), 30 ); |
|
23 | + add_action( 'customize_register', array( $this, 'register_background' ), 40 ); |
|
24 | + |
|
25 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
26 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
27 | + add_action( 'login_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
28 | + } |
|
29 | + |
|
30 | + /** |
|
31 | + * Customizer Controls and Settings. |
|
32 | + * |
|
33 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
34 | + * @since 1.0.0 |
|
35 | + */ |
|
36 | + public function register_general( $wp_customize ) { |
|
37 | + /** |
|
38 | + * Register the main panel |
|
39 | + */ |
|
40 | + $wp_customize->add_panel( |
|
41 | + 'login', |
|
42 | + array( |
|
43 | + 'title' => esc_html__( 'WP Login Screen', 'lsx-customizer' ), |
|
44 | + 'priority' => 60, |
|
45 | + ) |
|
46 | + ); |
|
47 | + |
|
48 | + /** |
|
49 | + * Reigster the Form section |
|
50 | + */ |
|
51 | + $wp_customize->add_section( |
|
52 | + 'login-general', |
|
53 | + array( |
|
54 | + 'title' => esc_html__( 'General', 'lsx-customizer' ), |
|
55 | + 'priority' => 1, |
|
56 | + 'panel' => 'login', |
|
57 | + ) |
|
58 | + ); |
|
59 | + |
|
60 | + /** |
|
61 | + * Select the background repeat. |
|
62 | + */ |
|
63 | + $wp_customize->add_setting( |
|
64 | + 'lsx_login_logo', |
|
65 | + array( |
|
66 | + 'default' => '', |
|
67 | + 'type' => 'theme_mod', |
|
68 | + 'transport' => 'postMessage', |
|
69 | + ) |
|
70 | + ); |
|
71 | + |
|
72 | + $wp_customize->add_control( |
|
73 | + new WP_Customize_Image_Control( |
|
74 | + $wp_customize, |
|
75 | + 'lsx_login_logo', |
|
76 | + array( |
|
77 | + 'label' => __( 'Upload a logo', 'lsx-customizer' ), |
|
78 | + 'section' => 'login-general', |
|
79 | + 'settings' => 'lsx_login_logo', |
|
80 | + ) |
|
81 | + ) |
|
82 | + ); |
|
83 | + |
|
84 | + /** |
|
85 | + * Link Colour |
|
86 | + */ |
|
87 | + $wp_customize->add_setting( |
|
88 | + 'lsx_login_link_colour', |
|
89 | + array( |
|
90 | + 'default' => '0085ba', |
|
91 | + 'type' => 'theme_mod', |
|
92 | + 'transport' => 'postMessage', |
|
93 | + ) |
|
94 | + ); |
|
95 | + $wp_customize->add_control( |
|
96 | + new WP_Customize_Color_Control( |
|
97 | + $wp_customize, |
|
98 | + 'lsx_login_link_colour', |
|
99 | + array( |
|
100 | + 'label' => __( 'Link Colour', 'lsx-customizer' ), |
|
101 | + 'section' => 'login-general', |
|
102 | + 'settings' => 'lsx_login_link_colour', |
|
103 | + ) |
|
104 | + ) |
|
105 | + ); |
|
106 | + |
|
107 | + /** |
|
108 | + * Link Hover Colour |
|
109 | + */ |
|
110 | + $wp_customize->add_setting( |
|
111 | + 'lsx_login_link_hover_colour', |
|
112 | + array( |
|
113 | + 'default' => '000000', |
|
114 | + 'type' => 'theme_mod', |
|
115 | + 'transport' => 'postMessage', |
|
116 | + ) |
|
117 | + ); |
|
118 | + $wp_customize->add_control( |
|
119 | + new WP_Customize_Color_Control( |
|
120 | + $wp_customize, |
|
121 | + 'lsx_login_link_hover_colour', |
|
122 | + array( |
|
123 | + 'label' => __( 'Link Hover Colour', 'lsx-customizer' ), |
|
124 | + 'section' => 'login-general', |
|
125 | + 'settings' => 'lsx_login_link_hover_colour', |
|
126 | + ) |
|
127 | + ) |
|
128 | + ); |
|
129 | + |
|
130 | + /** |
|
131 | + * Add in the custom CSS. |
|
132 | + */ |
|
133 | + $wp_customize->add_setting( |
|
134 | + 'lsx_login_custom_css', |
|
135 | + array( |
|
136 | + 'default' => '', |
|
137 | + 'type' => 'theme_mod', |
|
138 | + 'transport' => 'postMessage', |
|
139 | + ) |
|
140 | + ); |
|
141 | + $wp_customize->add_control( |
|
142 | + new WP_Customize_Control( |
|
143 | + $wp_customize, |
|
144 | + 'lsx_login_custom_css', |
|
145 | + array( |
|
146 | + 'label' => __( 'Custom CSS', 'lsx-customizer' ), |
|
147 | + 'section' => 'login-general', |
|
148 | + 'settings' => 'lsx_login_custom_css', |
|
149 | + 'type' => 'textarea', |
|
150 | + ) |
|
151 | + ) |
|
152 | + ); |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Customizer Controls and Settings. |
|
157 | + * |
|
158 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
159 | + * @since 1.0.0 |
|
160 | + */ |
|
161 | + public function register_form( $wp_customize ) { |
|
162 | + /** |
|
163 | + * Reigster the Form section |
|
164 | + */ |
|
165 | + $wp_customize->add_section( |
|
166 | + 'login-form', |
|
167 | + array( |
|
168 | + 'title' => esc_html__( 'Form', 'lsx-customizer' ), |
|
169 | + 'priority' => 1, |
|
170 | + 'panel' => 'login', |
|
171 | + ) |
|
172 | + ); |
|
173 | + |
|
174 | + /** |
|
175 | + * Form Background Colour |
|
176 | + */ |
|
177 | + $wp_customize->add_setting( |
|
178 | + 'lsx_login_form_colour', |
|
179 | + array( |
|
180 | + 'default' => 'ffffff', |
|
181 | + 'type' => 'theme_mod', |
|
182 | + 'transport' => 'postMessage', |
|
183 | + ) |
|
184 | + ); |
|
185 | + $wp_customize->add_control( |
|
186 | + new WP_Customize_Color_Control( |
|
187 | + $wp_customize, |
|
188 | + 'lsx_login_form_colour', |
|
189 | + array( |
|
190 | + 'label' => __( 'Form Background Color', 'lsx-customizer' ), |
|
191 | + 'section' => 'login-form', |
|
192 | + 'settings' => 'lsx_login_form_colour', |
|
193 | + ) |
|
194 | + ) |
|
195 | + ); |
|
196 | + |
|
197 | + /** |
|
198 | + * Form Label Colour |
|
199 | + */ |
|
200 | + $wp_customize->add_setting( |
|
201 | + 'lsx_login_form_label_colour', |
|
202 | + array( |
|
203 | + 'default' => 'ffffff', |
|
204 | + 'type' => 'theme_mod', |
|
205 | + 'transport' => 'postMessage', |
|
206 | + ) |
|
207 | + ); |
|
208 | + $wp_customize->add_control( |
|
209 | + new WP_Customize_Color_Control( |
|
210 | + $wp_customize, |
|
211 | + 'lsx_login_form_label_colour', |
|
212 | + array( |
|
213 | + 'label' => __( 'Form Label Color', 'lsx-customizer' ), |
|
214 | + 'section' => 'login-form', |
|
215 | + 'settings' => 'lsx_login_form_label_colour', |
|
216 | + ) |
|
217 | + ) |
|
218 | + ); |
|
219 | + |
|
220 | + /** |
|
221 | + * Button Color |
|
222 | + */ |
|
223 | + $wp_customize->add_setting( |
|
224 | + 'lsx_login_button_colour', |
|
225 | + array( |
|
226 | + 'default' => '000000', |
|
227 | + 'type' => 'theme_mod', |
|
228 | + 'transport' => 'postMessage', |
|
229 | + ) |
|
230 | + ); |
|
231 | + $wp_customize->add_control( |
|
232 | + new WP_Customize_Color_Control( |
|
233 | + $wp_customize, |
|
234 | + 'lsx_login_button_colour', |
|
235 | + array( |
|
236 | + 'label' => __( 'Button Colour', 'lsx-customizer' ), |
|
237 | + 'section' => 'login-form', |
|
238 | + 'settings' => 'lsx_login_button_colour', |
|
239 | + ) |
|
240 | + ) |
|
241 | + ); |
|
242 | + |
|
243 | + /** |
|
244 | + * Button Shadow Color |
|
245 | + */ |
|
246 | + $wp_customize->add_setting( |
|
247 | + 'lsx_login_button_shadow_colour', |
|
248 | + array( |
|
249 | + 'default' => '015d82', |
|
250 | + 'type' => 'theme_mod', |
|
251 | + 'transport' => 'postMessage', |
|
252 | + ) |
|
253 | + ); |
|
254 | + $wp_customize->add_control( |
|
255 | + new WP_Customize_Color_Control( |
|
256 | + $wp_customize, |
|
257 | + 'lsx_login_button_shadow_colour', |
|
258 | + array( |
|
259 | + 'label' => __( 'Button Shadow Colour', 'lsx-customizer' ), |
|
260 | + 'section' => 'login-form', |
|
261 | + 'settings' => 'lsx_login_button_shadow_colour', |
|
262 | + ) |
|
263 | + ) |
|
264 | + ); |
|
265 | + |
|
266 | + /** |
|
267 | + * Button Hover Color |
|
268 | + */ |
|
269 | + $wp_customize->add_setting( |
|
270 | + 'lsx_login_button_hover_colour', |
|
271 | + array( |
|
272 | + 'default' => '000000', |
|
273 | + 'type' => 'theme_mod', |
|
274 | + 'transport' => 'postMessage', |
|
275 | + ) |
|
276 | + ); |
|
277 | + $wp_customize->add_control( |
|
278 | + new WP_Customize_Color_Control( |
|
279 | + $wp_customize, |
|
280 | + 'lsx_login_button_hover_colour', |
|
281 | + array( |
|
282 | + 'label' => __( 'Button Hover Colour', 'lsx-customizer' ), |
|
283 | + 'section' => 'login-form', |
|
284 | + 'settings' => 'lsx_login_button_hover_colour', |
|
285 | + ) |
|
286 | + ) |
|
287 | + ); |
|
288 | + |
|
289 | + /** |
|
290 | + * Button Text Colour |
|
291 | + */ |
|
292 | + $wp_customize->add_setting( |
|
293 | + 'lsx_login_button_text_colour', |
|
294 | + array( |
|
295 | + 'default' => '0085ba', |
|
296 | + 'type' => 'theme_mod', |
|
297 | + 'transport' => 'postMessage', |
|
298 | + ) |
|
299 | + ); |
|
300 | + $wp_customize->add_control( |
|
301 | + new WP_Customize_Color_Control( |
|
302 | + $wp_customize, |
|
303 | + 'lsx_login_button_text_colour', |
|
304 | + array( |
|
305 | + 'label' => __( 'Button Text Colour', 'lsx-customizer' ), |
|
306 | + 'section' => 'login-form', |
|
307 | + 'settings' => 'lsx_login_button_text_colour', |
|
308 | + ) |
|
309 | + ) |
|
310 | + ); |
|
311 | + |
|
312 | + } |
|
313 | + |
|
314 | + /** |
|
315 | + * Customizer Controls and Settings. |
|
316 | + * |
|
317 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
318 | + * @since 1.0.0 |
|
319 | + */ |
|
320 | + public function register_background( $wp_customize ) { |
|
321 | + $wp_customize->add_section( |
|
322 | + 'login-background', |
|
323 | + array( |
|
324 | + 'title' => esc_html__( 'Background', 'lsx-customizer' ), |
|
325 | + 'priority' => 1, |
|
326 | + 'panel' => 'login', |
|
327 | + ) |
|
328 | + ); |
|
329 | + /** |
|
330 | + * Background Colour |
|
331 | + */ |
|
332 | + $wp_customize->add_setting( |
|
333 | + 'lsx_login_bg_colour', |
|
334 | + array( |
|
335 | + 'default' => 'ffffff', |
|
336 | + 'type' => 'theme_mod', |
|
337 | + 'transport' => 'postMessage', |
|
338 | + ) |
|
339 | + ); |
|
340 | + $wp_customize->add_control( |
|
341 | + new WP_Customize_Color_Control( |
|
342 | + $wp_customize, |
|
343 | + 'lsx_login_bg_colour', |
|
344 | + array( |
|
345 | + 'label' => __( 'Background Colour', 'lsx-customizer' ), |
|
346 | + 'section' => 'login-background', |
|
347 | + 'settings' => 'lsx_login_bg_colour', |
|
348 | + ) |
|
349 | + ) |
|
350 | + ); |
|
351 | + |
|
352 | + /** |
|
353 | + * Upload a Background Image |
|
354 | + */ |
|
355 | + $wp_customize->add_setting( |
|
356 | + 'lsx_login_bg_image', |
|
357 | + array( |
|
358 | + 'default' => '', |
|
359 | + 'type' => 'theme_mod', |
|
360 | + 'transport' => 'postMessage', |
|
361 | + ) |
|
362 | + ); |
|
363 | + |
|
364 | + $wp_customize->add_control( |
|
365 | + new WP_Customize_Image_Control( |
|
366 | + $wp_customize, |
|
367 | + 'lsx_login_bg_image', |
|
368 | + array( |
|
369 | + 'label' => __( 'Background Image', 'lsx-customizer' ), |
|
370 | + 'section' => 'login-background', |
|
371 | + 'settings' => 'lsx_login_bg_image', |
|
372 | + ) |
|
373 | + ) |
|
374 | + ); |
|
375 | + |
|
376 | + /** |
|
377 | + * Select the background repeat. |
|
378 | + */ |
|
379 | + $wp_customize->add_setting( |
|
380 | + 'lsx_login_bg_repeat', |
|
381 | + array( |
|
382 | + 'default' => 'no-repeat', |
|
383 | + 'type' => 'theme_mod', |
|
384 | + 'transport' => 'postMessage', |
|
385 | + ) |
|
386 | + ); |
|
387 | + $wp_customize->add_control( |
|
388 | + new WP_Customize_Control( |
|
389 | + $wp_customize, |
|
390 | + 'lsx_login_bg_repeat', |
|
391 | + array( |
|
392 | + 'label' => __( 'Background Repeat', 'lsx-customizer' ), |
|
393 | + 'section' => 'login-background', |
|
394 | + 'settings' => 'lsx_login_bg_repeat', |
|
395 | + 'type' => 'select', |
|
396 | + 'choices' => array( |
|
397 | + 'no-repeat' => __( 'No Repeat', 'lsx-customizer' ), |
|
398 | + 'repeat' => __( 'Repeat', 'lsx-customizer' ), |
|
399 | + 'repeat-x' => __( 'Repeat Horizontally', 'lsx-customizer' ), |
|
400 | + 'repeat-y' => __( 'Repeat Vertically', 'lsx-customizer' ), |
|
401 | + ), |
|
402 | + ) |
|
403 | + ) |
|
404 | + ); |
|
405 | + |
|
406 | + /** |
|
407 | + * Select the background repeat. |
|
408 | + */ |
|
409 | + $wp_customize->add_setting( |
|
410 | + 'lsx_login_bg_size', |
|
411 | + array( |
|
412 | + 'default' => 'none', |
|
413 | + 'type' => 'theme_mod', |
|
414 | + 'transport' => 'postMessage', |
|
415 | + ) |
|
416 | + ); |
|
417 | + $wp_customize->add_control( |
|
418 | + new WP_Customize_Control( |
|
419 | + $wp_customize, |
|
420 | + 'lsx_login_bg_size', |
|
421 | + array( |
|
422 | + 'label' => __( 'Background Size', 'lsx-customizer' ), |
|
423 | + 'section' => 'login-background', |
|
424 | + 'settings' => 'lsx_login_bg_size', |
|
425 | + 'type' => 'select', |
|
426 | + 'choices' => array( |
|
427 | + 'initial' => __( 'None', 'lsx-customizer' ), |
|
428 | + 'cover' => __( 'Cover', 'lsx-customizer' ), |
|
429 | + 'contain' => __( 'Contain', 'lsx-customizer' ), |
|
430 | + ), |
|
431 | + ) |
|
432 | + ) |
|
433 | + ); |
|
434 | + } |
|
435 | + |
|
436 | + /** |
|
437 | + * Assign CSS to theme mod. |
|
438 | + * |
|
439 | + * @since 1.0.0 |
|
440 | + */ |
|
441 | + public function set_theme_mod() { |
|
442 | + $theme_mods = $this->get_theme_mods(); |
|
443 | + $styles = $this->get_css( $theme_mods ); |
|
444 | + |
|
445 | + set_theme_mod( 'lsx_customizer_login_styles', $styles ); |
|
446 | + } |
|
447 | + |
|
448 | + /** |
|
449 | + * Enqueues front-end CSS. |
|
450 | + * |
|
451 | + * @since 1.0.0 |
|
452 | + */ |
|
453 | + public function enqueue_css() { |
|
454 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_login_styles' ); |
|
455 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
456 | + $theme_mods = $this->get_theme_mods(); |
|
457 | + $styles = $this->get_css( $theme_mods ); |
|
458 | + |
|
459 | + if ( false === $styles_from_theme_mod ) { |
|
460 | + set_theme_mod( 'lsx_customizer_login_styles', $styles ); |
|
461 | + } |
|
462 | + } else { |
|
463 | + $styles = $styles_from_theme_mod; |
|
464 | + } |
|
465 | + echo wp_kses( |
|
466 | + $styles, |
|
467 | + array( |
|
468 | + 'style' => array(), |
|
469 | + ) |
|
470 | + ); |
|
471 | + } |
|
472 | + |
|
473 | + /** |
|
474 | + * Get CSS theme mods. |
|
475 | + * |
|
476 | + * @since 1.0.0 |
|
477 | + */ |
|
478 | + public function get_theme_mods() { |
|
479 | + $mods = apply_filters( |
|
480 | + 'lsx_customizer_login_styles', |
|
481 | + array( |
|
482 | + 'logo' => get_theme_mod( 'lsx_login_logo', '' ), |
|
483 | + 'link_colour' => get_theme_mod( 'lsx_login_link_colour', '#0085ba' ), |
|
484 | + 'link_hover_colour' => get_theme_mod( 'lsx_login_link_hover_colour', '#0085ba' ), |
|
485 | + 'button_colour' => get_theme_mod( 'lsx_login_button_colour', '#0085ba' ), |
|
486 | + 'button_shadow_colour' => get_theme_mod( 'lsx_login_button_shadow_colour', '#015d82' ), |
|
487 | + 'button_hover_colour' => get_theme_mod( 'lsx_login_button_hover_colour', '#015d82' ), |
|
488 | + 'button_text_colour' => get_theme_mod( 'lsx_login_button_text_colour', '#ffffff' ), |
|
489 | + 'login_form_colour' => get_theme_mod( 'lsx_login_form_colour', '#ffffff' ), |
|
490 | + 'login_form_label_colour' => get_theme_mod( 'lsx_login_form_label_colour', '#333333' ), |
|
491 | + 'background_colour' => get_theme_mod( 'lsx_login_bg_colour', '#f2f2f2' ), |
|
492 | + 'background_image' => get_theme_mod( 'lsx_login_bg_image', '' ), |
|
493 | + 'background_repeat' => get_theme_mod( 'lsx_login_bg_repeat', 'no-repeat' ), |
|
494 | + 'background_size' => get_theme_mod( 'lsx_login_bg_size', 'initial' ), |
|
495 | + 'custom_css' => get_theme_mod( 'lsx_login_custom_css', '' ), |
|
496 | + ) |
|
497 | + ); |
|
498 | + return $mods; |
|
499 | + } |
|
500 | + |
|
501 | + /** |
|
502 | + * Returns CSS. |
|
503 | + * |
|
504 | + * @since 1.0.0 |
|
505 | + */ |
|
506 | + public function get_css( $theme_mods ) { |
|
507 | + $css = '<style>'; |
|
508 | + |
|
509 | + $css .= "body.login #backtoblog a, body.login #nav a { color: {$theme_mods['link_colour']}; }"; |
|
510 | + $css .= "body.login #nav a:hover, .login h1 a:hover, body.login #backtoblog a:hover { color: {$theme_mods['link_hover_colour']}; }"; |
|
511 | + $css .= "body.login.wp-core-ui .button-primary { background-color: {$theme_mods['button_colour']}; }"; |
|
512 | + $css .= "body.login.wp-core-ui .button-primary { border-color: {$theme_mods['button_colour']}; }"; |
|
513 | + $css .= "body.login.wp-core-ui .button-primary:hover { background-color: {$theme_mods['button_hover_colour']}; }"; |
|
514 | + $css .= "body.login.wp-core-ui .button-primary:hover { border-color: {$theme_mods['button_hover_colour']}; }"; |
|
515 | + $css .= "body.login .button-primary { box-shadow: 0 1px 0 {$theme_mods['button_shadow_colour']}; }"; |
|
516 | + $css .= "body.login .button-primary:active { box-shadow: 0 2px 0 {$theme_mods['button_shadow_colour']}; }"; |
|
517 | + $css .= "body.login .button-primary { color: {$theme_mods['button_text_colour']} ; }"; |
|
518 | + $css .= 'body.login .button-primary { text-shadow: none; }'; |
|
519 | + $css .= "body.login form { background: {$theme_mods['login_form_colour']}; }"; |
|
520 | + $css .= "body.login label { color: {$theme_mods['login_form_label_colour']}; }"; |
|
521 | + |
|
522 | + if ( isset( $theme_mods['logo'] ) && '' !== $theme_mods['logo'] ) { |
|
523 | + $css .= " |
|
524 | 524 | #login h1 a, .login h1 a { |
525 | 525 | background-image: url('" . $theme_mods['logo'] . "'); |
526 | 526 | max-height: 150px; |
@@ -529,22 +529,22 @@ discard block |
||
529 | 529 | background-repeat: no-repeat; |
530 | 530 | } |
531 | 531 | "; |
532 | - } |
|
533 | - |
|
534 | - // Add in the background image options. |
|
535 | - $background_image = ''; |
|
536 | - if ( isset( $theme_mods['background_image'] ) && '' !== $theme_mods['background_image'] ) { |
|
537 | - $background_image = "background-image:url('{$theme_mods['background_image']}');"; |
|
538 | - } |
|
539 | - $background_repeat = ''; |
|
540 | - if ( isset( $theme_mods['background_repeat'] ) && '' !== $theme_mods['background_repeat'] ) { |
|
541 | - $background_repeat = "background-repeat:{$theme_mods['background_repeat']};"; |
|
542 | - } |
|
543 | - $background_size = ''; |
|
544 | - if ( isset( $theme_mods['background_size'] ) && '' !== $theme_mods['background_size'] ) { |
|
545 | - $background_size = "background-size:{$theme_mods['background_size']};"; |
|
546 | - } |
|
547 | - $css .= " |
|
532 | + } |
|
533 | + |
|
534 | + // Add in the background image options. |
|
535 | + $background_image = ''; |
|
536 | + if ( isset( $theme_mods['background_image'] ) && '' !== $theme_mods['background_image'] ) { |
|
537 | + $background_image = "background-image:url('{$theme_mods['background_image']}');"; |
|
538 | + } |
|
539 | + $background_repeat = ''; |
|
540 | + if ( isset( $theme_mods['background_repeat'] ) && '' !== $theme_mods['background_repeat'] ) { |
|
541 | + $background_repeat = "background-repeat:{$theme_mods['background_repeat']};"; |
|
542 | + } |
|
543 | + $background_size = ''; |
|
544 | + if ( isset( $theme_mods['background_size'] ) && '' !== $theme_mods['background_size'] ) { |
|
545 | + $background_size = "background-size:{$theme_mods['background_size']};"; |
|
546 | + } |
|
547 | + $css .= " |
|
548 | 548 | .login { |
549 | 549 | background:{$theme_mods['background_colour']}; |
550 | 550 | {$background_image} |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | transition:0.4s; |
556 | 556 | }"; |
557 | 557 | |
558 | - // Add in the custom css |
|
559 | - if ( isset( $theme_mods['custom_css'] ) && '' !== $theme_mods['custom_css'] ) { |
|
560 | - $css .= $theme_mods['custom_css']; |
|
561 | - } |
|
562 | - |
|
563 | - $css .= '</style>'; |
|
564 | - $css = apply_filters( 'lsx_customizer_login_styles', $css ); |
|
565 | - return $css; |
|
566 | - } |
|
567 | - } |
|
568 | - new LSX_Customizer_Login(); |
|
558 | + // Add in the custom css |
|
559 | + if ( isset( $theme_mods['custom_css'] ) && '' !== $theme_mods['custom_css'] ) { |
|
560 | + $css .= $theme_mods['custom_css']; |
|
561 | + } |
|
562 | + |
|
563 | + $css .= '</style>'; |
|
564 | + $css = apply_filters( 'lsx_customizer_login_styles', $css ); |
|
565 | + return $css; |
|
566 | + } |
|
567 | + } |
|
568 | + new LSX_Customizer_Login(); |
|
569 | 569 | } |
@@ -1,105 +1,105 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Button' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Colour Button Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Colour_Button extends LSX_Customizer_Colour { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | - |
|
24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Assign CSS to theme mod. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public function set_theme_mod() { |
|
33 | - $theme_mods = $this->get_theme_mods(); |
|
34 | - $styles = $this->get_css( $theme_mods ); |
|
35 | - |
|
36 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Enqueues front-end CSS. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - */ |
|
44 | - public function enqueue_css() { |
|
45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_theme_mod' ); |
|
46 | - |
|
47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | - $theme_mods = $this->get_theme_mods(); |
|
49 | - $styles = $this->get_css( $theme_mods ); |
|
50 | - |
|
51 | - if ( false === $styles_from_theme_mod ) { |
|
52 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
53 | - } |
|
54 | - } else { |
|
55 | - $styles = $styles_from_theme_mod; |
|
56 | - } |
|
57 | - |
|
58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get CSS theme mods. |
|
63 | - * |
|
64 | - * @since 1.0.0 |
|
65 | - */ |
|
66 | - public function get_theme_mods() { |
|
67 | - $colors = parent::get_color_scheme(); |
|
68 | - |
|
69 | - return apply_filters( 'lsx_customizer_colours_button', array( |
|
70 | - 'button_background_color' => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
71 | - 'button_background_hover_color' => get_theme_mod( 'button_background_hover_color', $colors['button_background_hover_color'] ), |
|
72 | - 'button_text_color' => get_theme_mod( 'button_text_color', $colors['button_text_color'] ), |
|
73 | - 'button_text_color_hover' => get_theme_mod( 'button_text_color_hover', $colors['button_text_color_hover'] ), |
|
74 | - 'button_shadow' => get_theme_mod( 'button_shadow', $colors['button_shadow'] ), |
|
75 | - ) ); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Returns CSS. |
|
80 | - * |
|
81 | - * @since 1.0.0 |
|
82 | - */ |
|
83 | - function get_css( $colors ) { |
|
84 | - global $customizer_colour_names; |
|
85 | - |
|
86 | - $colors_template = array(); |
|
87 | - |
|
88 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
89 | - $colors_template[ $key ] = ''; |
|
90 | - } |
|
91 | - |
|
92 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
93 | - |
|
94 | - if ( empty( $colors['button_text_color'] ) |
|
95 | - || empty( $colors['button_text_color_hover'] ) |
|
96 | - || empty( $colors['button_background_color'] ) |
|
97 | - || empty( $colors['button_background_hover_color'] ) |
|
98 | - || empty( $colors['button_shadow'] ) ) { |
|
99 | - return ''; |
|
100 | - } |
|
101 | - |
|
102 | - $css = ' |
|
4 | + /** |
|
5 | + * LSX Customizer Colour Button Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Colour_Button extends LSX_Customizer_Colour { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | + |
|
24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Assign CSS to theme mod. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public function set_theme_mod() { |
|
33 | + $theme_mods = $this->get_theme_mods(); |
|
34 | + $styles = $this->get_css( $theme_mods ); |
|
35 | + |
|
36 | + set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Enqueues front-end CSS. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + */ |
|
44 | + public function enqueue_css() { |
|
45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_theme_mod' ); |
|
46 | + |
|
47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | + $theme_mods = $this->get_theme_mods(); |
|
49 | + $styles = $this->get_css( $theme_mods ); |
|
50 | + |
|
51 | + if ( false === $styles_from_theme_mod ) { |
|
52 | + set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
53 | + } |
|
54 | + } else { |
|
55 | + $styles = $styles_from_theme_mod; |
|
56 | + } |
|
57 | + |
|
58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get CSS theme mods. |
|
63 | + * |
|
64 | + * @since 1.0.0 |
|
65 | + */ |
|
66 | + public function get_theme_mods() { |
|
67 | + $colors = parent::get_color_scheme(); |
|
68 | + |
|
69 | + return apply_filters( 'lsx_customizer_colours_button', array( |
|
70 | + 'button_background_color' => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
71 | + 'button_background_hover_color' => get_theme_mod( 'button_background_hover_color', $colors['button_background_hover_color'] ), |
|
72 | + 'button_text_color' => get_theme_mod( 'button_text_color', $colors['button_text_color'] ), |
|
73 | + 'button_text_color_hover' => get_theme_mod( 'button_text_color_hover', $colors['button_text_color_hover'] ), |
|
74 | + 'button_shadow' => get_theme_mod( 'button_shadow', $colors['button_shadow'] ), |
|
75 | + ) ); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Returns CSS. |
|
80 | + * |
|
81 | + * @since 1.0.0 |
|
82 | + */ |
|
83 | + function get_css( $colors ) { |
|
84 | + global $customizer_colour_names; |
|
85 | + |
|
86 | + $colors_template = array(); |
|
87 | + |
|
88 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
89 | + $colors_template[ $key ] = ''; |
|
90 | + } |
|
91 | + |
|
92 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
93 | + |
|
94 | + if ( empty( $colors['button_text_color'] ) |
|
95 | + || empty( $colors['button_text_color_hover'] ) |
|
96 | + || empty( $colors['button_background_color'] ) |
|
97 | + || empty( $colors['button_background_hover_color'] ) |
|
98 | + || empty( $colors['button_shadow'] ) ) { |
|
99 | + return ''; |
|
100 | + } |
|
101 | + |
|
102 | + $css = ' |
|
103 | 103 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/button"; |
104 | 104 | |
105 | 105 | /** |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | ); |
115 | 115 | '; |
116 | 116 | |
117 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button', $css, $colors ); |
|
118 | - $css = parent::scss_to_css( $css ); |
|
117 | + $css = apply_filters( 'lsx_customizer_colour_selectors_button', $css, $colors ); |
|
118 | + $css = parent::scss_to_css( $css ); |
|
119 | 119 | |
120 | - return $css; |
|
121 | - } |
|
120 | + return $css; |
|
121 | + } |
|
122 | 122 | |
123 | - } |
|
123 | + } |
|
124 | 124 | |
125 | 125 | } |
@@ -1,109 +1,109 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Main_Menu' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Colour Main Menu Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Colour_Main_Menu extends LSX_Customizer_Colour { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | - |
|
24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Assign CSS to theme mod. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public function set_theme_mod() { |
|
33 | - $theme_mods = $this->get_theme_mods(); |
|
34 | - $styles = $this->get_css( $theme_mods ); |
|
35 | - |
|
36 | - set_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod', $styles ); |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Enqueues front-end CSS. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - */ |
|
44 | - public function enqueue_css() { |
|
45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod' ); |
|
46 | - |
|
47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | - $theme_mods = $this->get_theme_mods(); |
|
49 | - $styles = $this->get_css( $theme_mods ); |
|
50 | - |
|
51 | - if ( false === $styles_from_theme_mod ) { |
|
52 | - set_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod', $styles ); |
|
53 | - } |
|
54 | - } else { |
|
55 | - $styles = $styles_from_theme_mod; |
|
56 | - } |
|
57 | - |
|
58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get CSS theme mods. |
|
63 | - * |
|
64 | - * @since 1.0.0 |
|
65 | - */ |
|
66 | - public function get_theme_mods() { |
|
67 | - $colors = parent::get_color_scheme(); |
|
68 | - |
|
69 | - return apply_filters( 'lsx_customizer_colours_main_menu', array( |
|
70 | - 'main_menu_background_color' => get_theme_mod( 'main_menu_background_color', $colors['main_menu_background_color'] ), |
|
71 | - 'main_menu_link_color' => get_theme_mod( 'main_menu_link_color', $colors['main_menu_link_color'] ), |
|
72 | - 'main_menu_link_hover_color' => get_theme_mod( 'main_menu_link_hover_color', $colors['main_menu_link_hover_color'] ), |
|
73 | - 'main_menu_dropdown_background_color' => get_theme_mod( 'main_menu_dropdown_background_color', $colors['main_menu_dropdown_background_color'] ), |
|
74 | - 'main_menu_dropdown_background_hover_color' => get_theme_mod( 'main_menu_dropdown_background_hover_color', $colors['main_menu_dropdown_background_hover_color'] ), |
|
75 | - 'main_menu_dropdown_link_color' => get_theme_mod( 'main_menu_dropdown_link_color', $colors['main_menu_dropdown_link_color'] ), |
|
76 | - 'main_menu_dropdown_link_hover_color' => get_theme_mod( 'main_menu_dropdown_link_hover_color', $colors['main_menu_dropdown_link_hover_color'] ), |
|
77 | - ) ); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Returns CSS. |
|
82 | - * |
|
83 | - * @since 1.0.0 |
|
84 | - */ |
|
85 | - function get_css( $colors ) { |
|
86 | - global $customizer_colour_names; |
|
87 | - |
|
88 | - $colors_template = array(); |
|
89 | - |
|
90 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
91 | - $colors_template[ $key ] = ''; |
|
92 | - } |
|
93 | - |
|
94 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
95 | - |
|
96 | - if ( empty( $colors['main_menu_background_color'] ) |
|
97 | - || empty( $colors['main_menu_link_color'] ) |
|
98 | - || empty( $colors['main_menu_link_hover_color'] ) |
|
99 | - || empty( $colors['main_menu_dropdown_background_color'] ) |
|
100 | - || empty( $colors['main_menu_dropdown_background_hover_color'] ) |
|
101 | - || empty( $colors['main_menu_dropdown_link_color'] ) |
|
102 | - || empty( $colors['main_menu_dropdown_link_hover_color'] ) ) { |
|
103 | - return ''; |
|
104 | - } |
|
105 | - |
|
106 | - $css = ' |
|
4 | + /** |
|
5 | + * LSX Customizer Colour Main Menu Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Colour_Main_Menu extends LSX_Customizer_Colour { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
23 | + |
|
24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Assign CSS to theme mod. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public function set_theme_mod() { |
|
33 | + $theme_mods = $this->get_theme_mods(); |
|
34 | + $styles = $this->get_css( $theme_mods ); |
|
35 | + |
|
36 | + set_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod', $styles ); |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Enqueues front-end CSS. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + */ |
|
44 | + public function enqueue_css() { |
|
45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod' ); |
|
46 | + |
|
47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
48 | + $theme_mods = $this->get_theme_mods(); |
|
49 | + $styles = $this->get_css( $theme_mods ); |
|
50 | + |
|
51 | + if ( false === $styles_from_theme_mod ) { |
|
52 | + set_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod', $styles ); |
|
53 | + } |
|
54 | + } else { |
|
55 | + $styles = $styles_from_theme_mod; |
|
56 | + } |
|
57 | + |
|
58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get CSS theme mods. |
|
63 | + * |
|
64 | + * @since 1.0.0 |
|
65 | + */ |
|
66 | + public function get_theme_mods() { |
|
67 | + $colors = parent::get_color_scheme(); |
|
68 | + |
|
69 | + return apply_filters( 'lsx_customizer_colours_main_menu', array( |
|
70 | + 'main_menu_background_color' => get_theme_mod( 'main_menu_background_color', $colors['main_menu_background_color'] ), |
|
71 | + 'main_menu_link_color' => get_theme_mod( 'main_menu_link_color', $colors['main_menu_link_color'] ), |
|
72 | + 'main_menu_link_hover_color' => get_theme_mod( 'main_menu_link_hover_color', $colors['main_menu_link_hover_color'] ), |
|
73 | + 'main_menu_dropdown_background_color' => get_theme_mod( 'main_menu_dropdown_background_color', $colors['main_menu_dropdown_background_color'] ), |
|
74 | + 'main_menu_dropdown_background_hover_color' => get_theme_mod( 'main_menu_dropdown_background_hover_color', $colors['main_menu_dropdown_background_hover_color'] ), |
|
75 | + 'main_menu_dropdown_link_color' => get_theme_mod( 'main_menu_dropdown_link_color', $colors['main_menu_dropdown_link_color'] ), |
|
76 | + 'main_menu_dropdown_link_hover_color' => get_theme_mod( 'main_menu_dropdown_link_hover_color', $colors['main_menu_dropdown_link_hover_color'] ), |
|
77 | + ) ); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Returns CSS. |
|
82 | + * |
|
83 | + * @since 1.0.0 |
|
84 | + */ |
|
85 | + function get_css( $colors ) { |
|
86 | + global $customizer_colour_names; |
|
87 | + |
|
88 | + $colors_template = array(); |
|
89 | + |
|
90 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
91 | + $colors_template[ $key ] = ''; |
|
92 | + } |
|
93 | + |
|
94 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
95 | + |
|
96 | + if ( empty( $colors['main_menu_background_color'] ) |
|
97 | + || empty( $colors['main_menu_link_color'] ) |
|
98 | + || empty( $colors['main_menu_link_hover_color'] ) |
|
99 | + || empty( $colors['main_menu_dropdown_background_color'] ) |
|
100 | + || empty( $colors['main_menu_dropdown_background_hover_color'] ) |
|
101 | + || empty( $colors['main_menu_dropdown_link_color'] ) |
|
102 | + || empty( $colors['main_menu_dropdown_link_hover_color'] ) ) { |
|
103 | + return ''; |
|
104 | + } |
|
105 | + |
|
106 | + $css = ' |
|
107 | 107 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/nav"; |
108 | 108 | |
109 | 109 | /** |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | ); |
121 | 121 | '; |
122 | 122 | |
123 | - $css = apply_filters( 'lsx_customizer_colour_selectors_main_menu', $css, $colors ); |
|
124 | - $css = parent::scss_to_css( $css ); |
|
123 | + $css = apply_filters( 'lsx_customizer_colour_selectors_main_menu', $css, $colors ); |
|
124 | + $css = parent::scss_to_css( $css ); |
|
125 | 125 | |
126 | - return $css; |
|
127 | - } |
|
126 | + return $css; |
|
127 | + } |
|
128 | 128 | |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | 131 | } |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | * Add two new colors (test) in main array of colors |
7 | 7 | */ |
8 | 8 | function test_lsx_customizer_colour_names( $array ) { |
9 | - $array['test_text_color'] = esc_html__( 'TEST: Text', 'lsx-customizer' ); |
|
10 | - $array['test_text_color_hover'] = esc_html__( 'TEST: Text (hover)', 'lsx-customizer' ); |
|
11 | - return $array; |
|
9 | + $array['test_text_color'] = esc_html__( 'TEST: Text', 'lsx-customizer' ); |
|
10 | + $array['test_text_color_hover'] = esc_html__( 'TEST: Text (hover)', 'lsx-customizer' ); |
|
11 | + return $array; |
|
12 | 12 | } |
13 | 13 | add_filter( 'lsx_customizer_colour_names', 'test_lsx_customizer_colour_names' ); |
14 | 14 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * Add the new colors (test) in default scheme |
19 | 19 | */ |
20 | 20 | function test_lsx_customizer_colour_choices_default( $array ) { |
21 | - $array['test_text_color'] = '#ddddd1'; |
|
22 | - $array['test_text_color_hover'] = '#eeeee1'; |
|
23 | - return $array; |
|
21 | + $array['test_text_color'] = '#ddddd1'; |
|
22 | + $array['test_text_color_hover'] = '#eeeee1'; |
|
23 | + return $array; |
|
24 | 24 | } |
25 | 25 | add_filter( 'lsx_customizer_colour_choices_default', 'test_lsx_customizer_colour_choices_default' ); |
26 | 26 | |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * Add the new colors (test) in red scheme |
31 | 31 | */ |
32 | 32 | function test_lsx_customizer_colour_choices_red( $array ) { |
33 | - $array['test_text_color'] = '#ddddd2'; |
|
34 | - $array['test_text_color_hover'] = '#eeeee2'; |
|
35 | - return $array; |
|
33 | + $array['test_text_color'] = '#ddddd2'; |
|
34 | + $array['test_text_color_hover'] = '#eeeee2'; |
|
35 | + return $array; |
|
36 | 36 | } |
37 | 37 | add_filter( 'lsx_customizer_colour_choices_red', 'test_lsx_customizer_colour_choices_red' ); |
38 | 38 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * Add the new colors (test) in orange scheme |
43 | 43 | */ |
44 | 44 | function test_lsx_customizer_colour_choices_orange( $array ) { |
45 | - $array['test_text_color'] = '#ddddd3'; |
|
46 | - $array['test_text_color_hover'] = '#eeeee3'; |
|
47 | - return $array; |
|
45 | + $array['test_text_color'] = '#ddddd3'; |
|
46 | + $array['test_text_color_hover'] = '#eeeee3'; |
|
47 | + return $array; |
|
48 | 48 | } |
49 | 49 | add_filter( 'lsx_customizer_colour_choices_orange', 'test_lsx_customizer_colour_choices_orange' ); |
50 | 50 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * Add the new colors (test) in green scheme |
55 | 55 | */ |
56 | 56 | function test_lsx_customizer_colour_choices_green( $array ) { |
57 | - $array['test_text_color'] = '#ddddd4'; |
|
58 | - $array['test_text_color_hover'] = '#eeeee4'; |
|
59 | - return $array; |
|
57 | + $array['test_text_color'] = '#ddddd4'; |
|
58 | + $array['test_text_color_hover'] = '#eeeee4'; |
|
59 | + return $array; |
|
60 | 60 | } |
61 | 61 | add_filter( 'lsx_customizer_colour_choices_green', 'test_lsx_customizer_colour_choices_green' ); |
62 | 62 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * Add the new colors (test) in brown scheme |
67 | 67 | */ |
68 | 68 | function test_lsx_customizer_colour_choices_brown( $array ) { |
69 | - $array['test_text_color'] = '#ddddd5'; |
|
70 | - $array['test_text_color_hover'] = '#eeeee5'; |
|
71 | - return $array; |
|
69 | + $array['test_text_color'] = '#ddddd5'; |
|
70 | + $array['test_text_color_hover'] = '#eeeee5'; |
|
71 | + return $array; |
|
72 | 72 | } |
73 | 73 | add_filter( 'lsx_customizer_colour_choices_brown', 'test_lsx_customizer_colour_choices_brown' ); |
74 | 74 | |
@@ -79,88 +79,88 @@ discard block |
||
79 | 79 | * Also add the new colors (test) in new scheme |
80 | 80 | */ |
81 | 81 | function test_lsx_customizer_colour_choices( $array ) { |
82 | - $array['test'] = array( |
|
83 | - 'label' => esc_html__( 'Test', 'lsx-customizer' ), |
|
84 | - 'colors' => array( |
|
85 | - 'button_background_color' => '#428bca', |
|
86 | - 'button_background_hover_color' => '#2a6496', |
|
87 | - 'button_text_color' => '#ffffff', |
|
88 | - 'button_text_color_hover' => '#ffffff', |
|
89 | - 'button_shadow' => '#2a6496', |
|
90 | - |
|
91 | - 'button_cta_background_color' => '#f7941d', |
|
92 | - 'button_cta_background_hover_color' => '#f7741d', |
|
93 | - 'button_cta_text_color' => '#ffffff', |
|
94 | - 'button_cta_text_color_hover' => '#ffffff', |
|
95 | - 'button_cta_shadow' => '#f7741d', |
|
96 | - |
|
97 | - 'top_menu_background_color' => '#333333', |
|
98 | - 'top_menu_link_color' => '#ffffff', |
|
99 | - 'top_menu_link_hover_color' => '#428bca', |
|
100 | - 'top_menu_icon_color' => '#428bca', |
|
101 | - 'top_menu_icon_hover_color' => '#ffffff', |
|
102 | - 'top_menu_dropdown_color' => '#333333', |
|
103 | - 'top_menu_dropdown_hover_color' => '#444444', |
|
104 | - 'top_menu_dropdown_link_color' => '#ffffff', |
|
105 | - 'top_menu_dropdown_link_hover_color' => '#428bca', |
|
106 | - |
|
107 | - 'header_background_color' => '#ffffff', |
|
108 | - 'header_link_color' => '#428bca', |
|
109 | - 'header_link_hover_color' => '#1072c9', |
|
110 | - 'header_description_color' => '#555555', |
|
111 | - |
|
112 | - 'main_menu_background_color' => '#ffffff', |
|
113 | - 'main_menu_link_color' => '#555555', |
|
114 | - 'main_menu_link_hover_color' => '#ffffff', |
|
115 | - 'main_menu_dropdown_background_color' => '#428bca', |
|
116 | - 'main_menu_dropdown_background_hover_color' => '#1072c9', |
|
117 | - 'main_menu_dropdown_link_color' => '#ffffff', |
|
118 | - 'main_menu_dropdown_link_hover_color' => '#dddddd', |
|
119 | - |
|
120 | - 'banner_background_color' => '#2a6496', |
|
121 | - 'banner_text_color' => '#ffffff', |
|
122 | - 'banner_text_image_color' => '#ffffff', |
|
123 | - 'banner_breadcrumb_background_color' => '#374750', |
|
124 | - 'banner_breadcrumb_text_color' => '#919191', |
|
125 | - 'banner_breadcrumb_text_selected_color' => '#ffffff', |
|
126 | - |
|
127 | - 'background_color' => '#ffffff', |
|
128 | - 'body_line_color' => '#dddddd', |
|
129 | - 'body_text_heading_color' => '#333333', |
|
130 | - 'body_text_small_color' => '#919191', |
|
131 | - 'body_text_color' => '#333333', |
|
132 | - 'body_link_color' => '#596b46', |
|
133 | - 'body_link_hover_color' => '#3d4a30', |
|
134 | - 'body_section_full_background_color' => '#596b46', |
|
135 | - 'body_section_full_text_color' => '#ffffff', |
|
136 | - 'body_section_full_link_color' => '#eeeeee', |
|
137 | - 'body_section_full_link_hover_color' => '#dddddd', |
|
138 | - 'body_section_full_cta_background_color' => '#333333', |
|
139 | - 'body_section_full_cta_text_color' => '#ffffff', |
|
140 | - 'body_section_full_cta_link_color' => '#eeeeee', |
|
141 | - 'body_section_full_cta_link_hover_color' => '#dddddd', |
|
142 | - |
|
143 | - 'footer_cta_background_color' => '#428bca', |
|
144 | - 'footer_cta_text_color' => '#ffffff', |
|
145 | - 'footer_cta_link_color' => '#dddddd', |
|
146 | - 'footer_cta_link_hover_color' => '#ffffff', |
|
147 | - |
|
148 | - 'footer_widgets_background_color' => '#333333', |
|
149 | - 'footer_widgets_text_color' => '#eeeeee', |
|
150 | - 'footer_widgets_link_color' => '#428bca', |
|
151 | - 'footer_widgets_link_hover_color' => '#1072c9', |
|
152 | - |
|
153 | - 'footer_background_color' => '#232222', |
|
154 | - 'footer_text_color' => '#ffffff', |
|
155 | - 'footer_link_color' => '#428bca', |
|
156 | - 'footer_link_hover_color' => '#1072c9', |
|
157 | - |
|
158 | - 'test_text_color' => '#ddddd6', |
|
159 | - 'test_text_color_hover' => '#eeeee6', |
|
160 | - ), |
|
161 | - ); |
|
162 | - |
|
163 | - return $array; |
|
82 | + $array['test'] = array( |
|
83 | + 'label' => esc_html__( 'Test', 'lsx-customizer' ), |
|
84 | + 'colors' => array( |
|
85 | + 'button_background_color' => '#428bca', |
|
86 | + 'button_background_hover_color' => '#2a6496', |
|
87 | + 'button_text_color' => '#ffffff', |
|
88 | + 'button_text_color_hover' => '#ffffff', |
|
89 | + 'button_shadow' => '#2a6496', |
|
90 | + |
|
91 | + 'button_cta_background_color' => '#f7941d', |
|
92 | + 'button_cta_background_hover_color' => '#f7741d', |
|
93 | + 'button_cta_text_color' => '#ffffff', |
|
94 | + 'button_cta_text_color_hover' => '#ffffff', |
|
95 | + 'button_cta_shadow' => '#f7741d', |
|
96 | + |
|
97 | + 'top_menu_background_color' => '#333333', |
|
98 | + 'top_menu_link_color' => '#ffffff', |
|
99 | + 'top_menu_link_hover_color' => '#428bca', |
|
100 | + 'top_menu_icon_color' => '#428bca', |
|
101 | + 'top_menu_icon_hover_color' => '#ffffff', |
|
102 | + 'top_menu_dropdown_color' => '#333333', |
|
103 | + 'top_menu_dropdown_hover_color' => '#444444', |
|
104 | + 'top_menu_dropdown_link_color' => '#ffffff', |
|
105 | + 'top_menu_dropdown_link_hover_color' => '#428bca', |
|
106 | + |
|
107 | + 'header_background_color' => '#ffffff', |
|
108 | + 'header_link_color' => '#428bca', |
|
109 | + 'header_link_hover_color' => '#1072c9', |
|
110 | + 'header_description_color' => '#555555', |
|
111 | + |
|
112 | + 'main_menu_background_color' => '#ffffff', |
|
113 | + 'main_menu_link_color' => '#555555', |
|
114 | + 'main_menu_link_hover_color' => '#ffffff', |
|
115 | + 'main_menu_dropdown_background_color' => '#428bca', |
|
116 | + 'main_menu_dropdown_background_hover_color' => '#1072c9', |
|
117 | + 'main_menu_dropdown_link_color' => '#ffffff', |
|
118 | + 'main_menu_dropdown_link_hover_color' => '#dddddd', |
|
119 | + |
|
120 | + 'banner_background_color' => '#2a6496', |
|
121 | + 'banner_text_color' => '#ffffff', |
|
122 | + 'banner_text_image_color' => '#ffffff', |
|
123 | + 'banner_breadcrumb_background_color' => '#374750', |
|
124 | + 'banner_breadcrumb_text_color' => '#919191', |
|
125 | + 'banner_breadcrumb_text_selected_color' => '#ffffff', |
|
126 | + |
|
127 | + 'background_color' => '#ffffff', |
|
128 | + 'body_line_color' => '#dddddd', |
|
129 | + 'body_text_heading_color' => '#333333', |
|
130 | + 'body_text_small_color' => '#919191', |
|
131 | + 'body_text_color' => '#333333', |
|
132 | + 'body_link_color' => '#596b46', |
|
133 | + 'body_link_hover_color' => '#3d4a30', |
|
134 | + 'body_section_full_background_color' => '#596b46', |
|
135 | + 'body_section_full_text_color' => '#ffffff', |
|
136 | + 'body_section_full_link_color' => '#eeeeee', |
|
137 | + 'body_section_full_link_hover_color' => '#dddddd', |
|
138 | + 'body_section_full_cta_background_color' => '#333333', |
|
139 | + 'body_section_full_cta_text_color' => '#ffffff', |
|
140 | + 'body_section_full_cta_link_color' => '#eeeeee', |
|
141 | + 'body_section_full_cta_link_hover_color' => '#dddddd', |
|
142 | + |
|
143 | + 'footer_cta_background_color' => '#428bca', |
|
144 | + 'footer_cta_text_color' => '#ffffff', |
|
145 | + 'footer_cta_link_color' => '#dddddd', |
|
146 | + 'footer_cta_link_hover_color' => '#ffffff', |
|
147 | + |
|
148 | + 'footer_widgets_background_color' => '#333333', |
|
149 | + 'footer_widgets_text_color' => '#eeeeee', |
|
150 | + 'footer_widgets_link_color' => '#428bca', |
|
151 | + 'footer_widgets_link_hover_color' => '#1072c9', |
|
152 | + |
|
153 | + 'footer_background_color' => '#232222', |
|
154 | + 'footer_text_color' => '#ffffff', |
|
155 | + 'footer_link_color' => '#428bca', |
|
156 | + 'footer_link_hover_color' => '#1072c9', |
|
157 | + |
|
158 | + 'test_text_color' => '#ddddd6', |
|
159 | + 'test_text_color_hover' => '#eeeee6', |
|
160 | + ), |
|
161 | + ); |
|
162 | + |
|
163 | + return $array; |
|
164 | 164 | } |
165 | 165 | add_filter( 'lsx_customizer_colour_choices', 'test_lsx_customizer_colour_choices' ); |
166 | 166 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * Add new selectors in "button" group of colours |
171 | 171 | */ |
172 | 172 | function test_lsx_customizer_colour_selectors_button( $css, $colors ) { |
173 | - $css .= <<<CSS |
|
173 | + $css .= <<<CSS |
|
174 | 174 | |
175 | 175 | /* Button TEST */ |
176 | 176 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | CSS; |
185 | 185 | |
186 | - return $css; |
|
186 | + return $css; |
|
187 | 187 | } |
188 | 188 | add_filter( 'lsx_customizer_colour_selectors_button', 'test_lsx_customizer_colour_selectors_button', 10, 2 ); |
189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * Add new selectors in "button cta" group of colours |
194 | 194 | */ |
195 | 195 | function test_lsx_customizer_colour_selectors_button_cta( $css, $colors ) { |
196 | - $css .= <<<CSS |
|
196 | + $css .= <<<CSS |
|
197 | 197 | |
198 | 198 | /* Button CTA TEST */ |
199 | 199 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | CSS; |
208 | 208 | |
209 | - return $css; |
|
209 | + return $css; |
|
210 | 210 | } |
211 | 211 | add_filter( 'lsx_customizer_colour_selectors_button_cta', 'test_lsx_customizer_colour_selectors_button_cta', 10, 2 ); |
212 | 212 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * Add new selectors in "top menu" group of colours |
217 | 217 | */ |
218 | 218 | function test_lsx_customizer_colour_selectors_top_menu( $css, $colors ) { |
219 | - $css .= <<<CSS |
|
219 | + $css .= <<<CSS |
|
220 | 220 | |
221 | 221 | /* Top Menu TEST */ |
222 | 222 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | CSS; |
235 | 235 | |
236 | - return $css; |
|
236 | + return $css; |
|
237 | 237 | } |
238 | 238 | add_filter( 'lsx_customizer_colour_selectors_top_menu', 'test_lsx_customizer_colour_selectors_top_menu', 10, 2 ); |
239 | 239 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * Add new selectors in "header" group of colours |
244 | 244 | */ |
245 | 245 | function test_lsx_customizer_colour_selectors_header( $css, $colors ) { |
246 | - $css .= <<<CSS |
|
246 | + $css .= <<<CSS |
|
247 | 247 | |
248 | 248 | /* Header TEST */ |
249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | CSS; |
257 | 257 | |
258 | - return $css; |
|
258 | + return $css; |
|
259 | 259 | } |
260 | 260 | add_filter( 'lsx_customizer_colour_selectors_header', 'test_lsx_customizer_colour_selectors_header', 10, 2 ); |
261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * Add new selectors in "main meun" group of colours |
266 | 266 | */ |
267 | 267 | function test_lsx_customizer_colour_selectors_main_menu( $css, $colors ) { |
268 | - $css .= <<<CSS |
|
268 | + $css .= <<<CSS |
|
269 | 269 | |
270 | 270 | /* Main Menu TEST */ |
271 | 271 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | CSS; |
282 | 282 | |
283 | - return $css; |
|
283 | + return $css; |
|
284 | 284 | } |
285 | 285 | add_filter( 'lsx_customizer_colour_selectors_main_menu', 'test_lsx_customizer_colour_selectors_main_menu', 10, 2 ); |
286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * Add new selectors in "banner" group of colours |
291 | 291 | */ |
292 | 292 | function test_lsx_customizer_colour_selectors_banner( $css, $colors ) { |
293 | - $css .= <<<CSS |
|
293 | + $css .= <<<CSS |
|
294 | 294 | |
295 | 295 | /* Banner TEST */ |
296 | 296 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | CSS; |
306 | 306 | |
307 | - return $css; |
|
307 | + return $css; |
|
308 | 308 | } |
309 | 309 | add_filter( 'lsx_customizer_colour_selectors_banner', 'test_lsx_customizer_colour_selectors_banner', 10, 2 ); |
310 | 310 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * Add new selectors in "body" group of colours |
315 | 315 | */ |
316 | 316 | function test_lsx_customizer_colour_selectors_body( $css, $colors ) { |
317 | - $css .= <<<CSS |
|
317 | + $css .= <<<CSS |
|
318 | 318 | |
319 | 319 | /* Body TEST */ |
320 | 320 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | CSS; |
340 | 340 | |
341 | - return $css; |
|
341 | + return $css; |
|
342 | 342 | } |
343 | 343 | add_filter( 'lsx_customizer_colour_selectors_body', 'test_lsx_customizer_colour_selectors_body', 10, 2 ); |
344 | 344 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * Add new selectors in "footer cta" group of colours |
349 | 349 | */ |
350 | 350 | function test_lsx_customizer_colour_selectors_footer_cta( $css, $colors ) { |
351 | - $css .= <<<CSS |
|
351 | + $css .= <<<CSS |
|
352 | 352 | |
353 | 353 | /* Footer CTA TEST */ |
354 | 354 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | CSS; |
362 | 362 | |
363 | - return $css; |
|
363 | + return $css; |
|
364 | 364 | } |
365 | 365 | add_filter( 'lsx_customizer_colour_selectors_footer_cta', 'test_lsx_customizer_colour_selectors_footer_cta', 10, 2 ); |
366 | 366 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | * Add new selectors in "footer widgets" group of colours |
371 | 371 | */ |
372 | 372 | function test_lsx_customizer_colour_selectors_footer_widgets( $css, $colors ) { |
373 | - $css .= <<<CSS |
|
373 | + $css .= <<<CSS |
|
374 | 374 | |
375 | 375 | /* Footer Widgets TEST */ |
376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | } |
383 | 383 | CSS; |
384 | 384 | |
385 | - return $css; |
|
385 | + return $css; |
|
386 | 386 | } |
387 | 387 | add_filter( 'lsx_customizer_colour_selectors_footer_widgets', 'test_lsx_customizer_colour_selectors_footer_widgets', 10, 2 ); |
388 | 388 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * Add new selectors in "footer" group of colours |
393 | 393 | */ |
394 | 394 | function test_lsx_customizer_colour_selectors_footer( $css, $colors ) { |
395 | - $css .= <<<CSS |
|
395 | + $css .= <<<CSS |
|
396 | 396 | |
397 | 397 | /* Footer TEST */ |
398 | 398 | |
@@ -404,6 +404,6 @@ discard block |
||
404 | 404 | } |
405 | 405 | CSS; |
406 | 406 | |
407 | - return $css; |
|
407 | + return $css; |
|
408 | 408 | } |
409 | 409 | add_filter( 'lsx_customizer_colour_selectors_footer', 'test_lsx_customizer_colour_selectors_footer', 10, 2 ); |
@@ -1,57 +1,57 @@ |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Wysiwyg_Control' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Wysiwyg Control Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Wysiwyg_Control extends WP_Customize_Control { |
|
14 | - |
|
15 | - public $type = 'wysiwyg'; |
|
16 | - |
|
17 | - /** |
|
18 | - * Render the control's content. |
|
19 | - * |
|
20 | - * @since 1.1.1 |
|
21 | - */ |
|
22 | - public function render_content() { |
|
23 | - ?> |
|
4 | + /** |
|
5 | + * LSX Customizer Wysiwyg Control Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Wysiwyg_Control extends WP_Customize_Control { |
|
14 | + |
|
15 | + public $type = 'wysiwyg'; |
|
16 | + |
|
17 | + /** |
|
18 | + * Render the control's content. |
|
19 | + * |
|
20 | + * @since 1.1.1 |
|
21 | + */ |
|
22 | + public function render_content() { |
|
23 | + ?> |
|
24 | 24 | <label> |
25 | 25 | <?php if ( ! empty( $this->label ) ) { ?> |
26 | 26 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
27 | 27 | <?php } ?> |
28 | 28 | <?php |
29 | - $settings = array( |
|
30 | - 'media_buttons' => false, |
|
31 | - 'teeny' => true, |
|
32 | - ); |
|
33 | - |
|
34 | - $this->filter_editor_setting_link(); |
|
35 | - wp_editor( $this->value(), $this->id, $settings ); |
|
36 | - ?> |
|
29 | + $settings = array( |
|
30 | + 'media_buttons' => false, |
|
31 | + 'teeny' => true, |
|
32 | + ); |
|
33 | + |
|
34 | + $this->filter_editor_setting_link(); |
|
35 | + wp_editor( $this->value(), $this->id, $settings ); |
|
36 | + ?> |
|
37 | 37 | </label> |
38 | 38 | <?php |
39 | - do_action( 'admin_footer' ); |
|
40 | - do_action( 'admin_print_footer_scripts' ); |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Filter editor setting link. |
|
45 | - * |
|
46 | - * @since 1.1.1 |
|
47 | - */ |
|
48 | - private function filter_editor_setting_link() { |
|
49 | - add_filter( 'the_editor', function( $output ) { |
|
50 | - return preg_replace( '/<textarea/', '<textarea ' . $this->get_link(), $output, 1 ); |
|
51 | - } ); |
|
52 | - } |
|
53 | - |
|
54 | - } |
|
39 | + do_action( 'admin_footer' ); |
|
40 | + do_action( 'admin_print_footer_scripts' ); |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Filter editor setting link. |
|
45 | + * |
|
46 | + * @since 1.1.1 |
|
47 | + */ |
|
48 | + private function filter_editor_setting_link() { |
|
49 | + add_filter( 'the_editor', function( $output ) { |
|
50 | + return preg_replace( '/<textarea/', '<textarea ' . $this->get_link(), $output, 1 ); |
|
51 | + } ); |
|
52 | + } |
|
53 | + |
|
54 | + } |
|
55 | 55 | |
56 | 56 | } |
57 | 57 |
@@ -1,63 +1,63 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Frontend' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Frontend Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Frontend extends LSX_Customizer { |
|
14 | - |
|
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 2999 ); |
|
22 | - add_action( 'wp_enqueue_scripts', array( $this, 'lsx_customizer_color_palette_css' ), 2999 ); |
|
23 | - add_action( 'wp', array( $this, 'layout' ), 2999 ); |
|
24 | - add_action( 'wp', array( $this, 'lsx_distraction_free_checkout' ), 2999 ); |
|
25 | - add_action( 'wp', array( $this, 'lsx_customizer_two_step_checkout' ) ); |
|
26 | - add_action( 'after_setup_theme', array( $this, 'lsx_customizer_color_palette_setup' ), 100 ); |
|
27 | - } |
|
28 | - |
|
29 | - /** |
|
30 | - * Enques the assets. |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - */ |
|
34 | - public function assets() { |
|
35 | - wp_enqueue_script( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
36 | - |
|
37 | - $params = apply_filters( 'lsx_customizer_js_params', array( |
|
38 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
39 | - )); |
|
40 | - |
|
41 | - wp_localize_script( 'lsx-customizer', 'lsx_customizer_params', $params ); |
|
42 | - |
|
43 | - wp_enqueue_style( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer.css', array(), LSX_CUSTOMIZER_VER ); |
|
44 | - wp_style_add_data( 'lsx-customizer', 'rtl', 'replace' ); |
|
45 | - |
|
46 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
47 | - if ( class_exists( 'WooCommerce' ) && function_exists( 'is_checkout' ) && is_checkout() && ! empty( $two_step_checkout ) ) { |
|
48 | - |
|
49 | - wp_enqueue_script( 'flexslider', LSX_CUSTOMIZER_URL . 'assets/js/jquery.flexslider.min.js', array( 'jquery' ), '2.5.0' ); |
|
50 | - } |
|
51 | - |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Enqueues front-end colour palette CSS. |
|
56 | - * |
|
57 | - * @since 1.0.0 |
|
58 | - */ |
|
59 | - public function lsx_customizer_color_palette_css() { |
|
60 | - $styles = ' |
|
4 | + /** |
|
5 | + * LSX Customizer Frontend Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Frontend extends LSX_Customizer { |
|
14 | + |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 2999 ); |
|
22 | + add_action( 'wp_enqueue_scripts', array( $this, 'lsx_customizer_color_palette_css' ), 2999 ); |
|
23 | + add_action( 'wp', array( $this, 'layout' ), 2999 ); |
|
24 | + add_action( 'wp', array( $this, 'lsx_distraction_free_checkout' ), 2999 ); |
|
25 | + add_action( 'wp', array( $this, 'lsx_customizer_two_step_checkout' ) ); |
|
26 | + add_action( 'after_setup_theme', array( $this, 'lsx_customizer_color_palette_setup' ), 100 ); |
|
27 | + } |
|
28 | + |
|
29 | + /** |
|
30 | + * Enques the assets. |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + */ |
|
34 | + public function assets() { |
|
35 | + wp_enqueue_script( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
36 | + |
|
37 | + $params = apply_filters( 'lsx_customizer_js_params', array( |
|
38 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
39 | + )); |
|
40 | + |
|
41 | + wp_localize_script( 'lsx-customizer', 'lsx_customizer_params', $params ); |
|
42 | + |
|
43 | + wp_enqueue_style( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer.css', array(), LSX_CUSTOMIZER_VER ); |
|
44 | + wp_style_add_data( 'lsx-customizer', 'rtl', 'replace' ); |
|
45 | + |
|
46 | + $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
47 | + if ( class_exists( 'WooCommerce' ) && function_exists( 'is_checkout' ) && is_checkout() && ! empty( $two_step_checkout ) ) { |
|
48 | + |
|
49 | + wp_enqueue_script( 'flexslider', LSX_CUSTOMIZER_URL . 'assets/js/jquery.flexslider.min.js', array( 'jquery' ), '2.5.0' ); |
|
50 | + } |
|
51 | + |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Enqueues front-end colour palette CSS. |
|
56 | + * |
|
57 | + * @since 1.0.0 |
|
58 | + */ |
|
59 | + public function lsx_customizer_color_palette_css() { |
|
60 | + $styles = ' |
|
61 | 61 | .container #primary.content-area .has-primary-color-background-color { |
62 | 62 | background-color:' . get_theme_mod( 'primary_color', '#428bca' ) . '; |
63 | 63 | } |
@@ -136,122 +136,122 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | '; |
139 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Layout. |
|
144 | - * |
|
145 | - * @since 1.0.0 |
|
146 | - */ |
|
147 | - public function layout() { |
|
148 | - $theme_credit = get_theme_mod( 'lsx_theme_credit_status', true ); |
|
149 | - |
|
150 | - if ( false == $theme_credit ) { |
|
151 | - add_filter( 'lsx_credit_link', '__return_false' ); |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Create the distraction free checkout. |
|
157 | - * |
|
158 | - * @since 1.0.0 |
|
159 | - * @return void |
|
160 | - */ |
|
161 | - public function lsx_distraction_free_checkout() { |
|
162 | - |
|
163 | - $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
164 | - |
|
165 | - if ( class_exists( 'WooCommerce' ) && function_exists( 'is_checkout' ) && is_checkout() && ! empty( $distraction_free ) ) { |
|
166 | - remove_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
167 | - |
|
168 | - } |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * Create the two step checkout. |
|
173 | - * |
|
174 | - * @since 1.0.0 |
|
175 | - * @return void |
|
176 | - */ |
|
177 | - public function lsx_customizer_two_step_checkout() { |
|
178 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
179 | - |
|
180 | - if ( class_exists( 'WooCommerce' ) && function_exists( 'is_checkout' ) && is_checkout() && ! empty( $two_step_checkout ) ) { |
|
181 | - add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper_div', 1 ); |
|
182 | - add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper', 2 ); |
|
183 | - add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_div', 30 ); |
|
184 | - add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_ul', 30 ); |
|
185 | - add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_address_wrapper', 5 ); |
|
186 | - add_action( 'woocommerce_checkout_after_customer_details', 'lsx_customizer_close_li' ); |
|
187 | - add_action( 'wp_footer', 'lsx_customizer_fire_flexslider' ); |
|
188 | - add_action( 'woocommerce_checkout_before_order_review', 'lsx_customizer_order_review_wrap', 1 ); |
|
189 | - add_action( 'woocommerce_checkout_after_order_review', 'lsx_customizer_close_li', 40 ); |
|
190 | - } |
|
191 | - } |
|
192 | - |
|
193 | - /** |
|
194 | - * Editor color palette. |
|
195 | - * |
|
196 | - * @return void |
|
197 | - */ |
|
198 | - public function lsx_customizer_color_palette_setup() { |
|
199 | - add_theme_support( 'editor-color-palette', array( |
|
200 | - array( |
|
201 | - 'name' => esc_html__( 'Primary Color', 'lsx-customizer' ), |
|
202 | - 'slug' => 'primary-color', |
|
203 | - 'color' => get_theme_mod( 'primary_color', '#428bca' ), |
|
204 | - ), |
|
205 | - array( |
|
206 | - 'name' => esc_html__( 'Strong Primary Color', 'lsx-customizer' ), |
|
207 | - 'slug' => 'strong-primary-color', |
|
208 | - 'color' => get_theme_mod( 'strong_primary_color', '#2a6496' ), |
|
209 | - ), |
|
210 | - array( |
|
211 | - 'name' => esc_html__( 'CTA Color', 'lsx-customizer' ), |
|
212 | - 'slug' => 'cta-color', |
|
213 | - 'color' => get_theme_mod( 'call_to_action_color', '#f7941d' ), |
|
214 | - ), |
|
215 | - array( |
|
216 | - 'name' => esc_html__( 'Strong CTA Color', 'lsx-customizer' ), |
|
217 | - 'slug' => 'strong-cta-color', |
|
218 | - 'color' => get_theme_mod( 'strong_cta_color', '#f7741d' ), |
|
219 | - ), |
|
220 | - array( |
|
221 | - 'name' => esc_html__( 'Secondary Color', 'lsx-customizer' ), |
|
222 | - 'slug' => 'secondary-color', |
|
223 | - 'color' => get_theme_mod( 'secondary_color', '#eaeaea' ), |
|
224 | - ), |
|
225 | - array( |
|
226 | - 'name' => esc_html__( 'Strong Secondary Color', 'lsx-customizer' ), |
|
227 | - 'slug' => 'strong-secondary-color', |
|
228 | - 'color' => get_theme_mod( 'strong_secondary_color', '#c4c4c4' ), |
|
229 | - ), |
|
230 | - array( |
|
231 | - 'name' => esc_html__( 'Tertiary Color', 'lsx-customizer' ), |
|
232 | - 'slug' => 'tertiary-color', |
|
233 | - 'color' => get_theme_mod( 'tertiary_color', '#6BA913' ), |
|
234 | - ), |
|
235 | - array( |
|
236 | - 'name' => esc_html__( 'Strong Tertiary Color', 'lsx-customizer' ), |
|
237 | - 'slug' => 'strong-tertiary-color', |
|
238 | - 'color' => get_theme_mod( 'strong_tertiary_color', '#3F640B' ), |
|
239 | - ), |
|
240 | - array( |
|
241 | - 'name' => esc_html__( 'White', 'lsx-customizer' ), |
|
242 | - 'slug' => 'white', |
|
243 | - 'color' => '#ffffff', |
|
244 | - ), |
|
245 | - array( |
|
246 | - 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
247 | - 'slug' => 'black', |
|
248 | - 'color' => '#000000', |
|
249 | - ), |
|
250 | - )); |
|
251 | - } |
|
252 | - |
|
253 | - } |
|
254 | - |
|
255 | - new LSX_Customizer_Frontend(); |
|
139 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * Layout. |
|
144 | + * |
|
145 | + * @since 1.0.0 |
|
146 | + */ |
|
147 | + public function layout() { |
|
148 | + $theme_credit = get_theme_mod( 'lsx_theme_credit_status', true ); |
|
149 | + |
|
150 | + if ( false == $theme_credit ) { |
|
151 | + add_filter( 'lsx_credit_link', '__return_false' ); |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Create the distraction free checkout. |
|
157 | + * |
|
158 | + * @since 1.0.0 |
|
159 | + * @return void |
|
160 | + */ |
|
161 | + public function lsx_distraction_free_checkout() { |
|
162 | + |
|
163 | + $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
164 | + |
|
165 | + if ( class_exists( 'WooCommerce' ) && function_exists( 'is_checkout' ) && is_checkout() && ! empty( $distraction_free ) ) { |
|
166 | + remove_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
167 | + |
|
168 | + } |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * Create the two step checkout. |
|
173 | + * |
|
174 | + * @since 1.0.0 |
|
175 | + * @return void |
|
176 | + */ |
|
177 | + public function lsx_customizer_two_step_checkout() { |
|
178 | + $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
179 | + |
|
180 | + if ( class_exists( 'WooCommerce' ) && function_exists( 'is_checkout' ) && is_checkout() && ! empty( $two_step_checkout ) ) { |
|
181 | + add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper_div', 1 ); |
|
182 | + add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper', 2 ); |
|
183 | + add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_div', 30 ); |
|
184 | + add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_ul', 30 ); |
|
185 | + add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_address_wrapper', 5 ); |
|
186 | + add_action( 'woocommerce_checkout_after_customer_details', 'lsx_customizer_close_li' ); |
|
187 | + add_action( 'wp_footer', 'lsx_customizer_fire_flexslider' ); |
|
188 | + add_action( 'woocommerce_checkout_before_order_review', 'lsx_customizer_order_review_wrap', 1 ); |
|
189 | + add_action( 'woocommerce_checkout_after_order_review', 'lsx_customizer_close_li', 40 ); |
|
190 | + } |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * Editor color palette. |
|
195 | + * |
|
196 | + * @return void |
|
197 | + */ |
|
198 | + public function lsx_customizer_color_palette_setup() { |
|
199 | + add_theme_support( 'editor-color-palette', array( |
|
200 | + array( |
|
201 | + 'name' => esc_html__( 'Primary Color', 'lsx-customizer' ), |
|
202 | + 'slug' => 'primary-color', |
|
203 | + 'color' => get_theme_mod( 'primary_color', '#428bca' ), |
|
204 | + ), |
|
205 | + array( |
|
206 | + 'name' => esc_html__( 'Strong Primary Color', 'lsx-customizer' ), |
|
207 | + 'slug' => 'strong-primary-color', |
|
208 | + 'color' => get_theme_mod( 'strong_primary_color', '#2a6496' ), |
|
209 | + ), |
|
210 | + array( |
|
211 | + 'name' => esc_html__( 'CTA Color', 'lsx-customizer' ), |
|
212 | + 'slug' => 'cta-color', |
|
213 | + 'color' => get_theme_mod( 'call_to_action_color', '#f7941d' ), |
|
214 | + ), |
|
215 | + array( |
|
216 | + 'name' => esc_html__( 'Strong CTA Color', 'lsx-customizer' ), |
|
217 | + 'slug' => 'strong-cta-color', |
|
218 | + 'color' => get_theme_mod( 'strong_cta_color', '#f7741d' ), |
|
219 | + ), |
|
220 | + array( |
|
221 | + 'name' => esc_html__( 'Secondary Color', 'lsx-customizer' ), |
|
222 | + 'slug' => 'secondary-color', |
|
223 | + 'color' => get_theme_mod( 'secondary_color', '#eaeaea' ), |
|
224 | + ), |
|
225 | + array( |
|
226 | + 'name' => esc_html__( 'Strong Secondary Color', 'lsx-customizer' ), |
|
227 | + 'slug' => 'strong-secondary-color', |
|
228 | + 'color' => get_theme_mod( 'strong_secondary_color', '#c4c4c4' ), |
|
229 | + ), |
|
230 | + array( |
|
231 | + 'name' => esc_html__( 'Tertiary Color', 'lsx-customizer' ), |
|
232 | + 'slug' => 'tertiary-color', |
|
233 | + 'color' => get_theme_mod( 'tertiary_color', '#6BA913' ), |
|
234 | + ), |
|
235 | + array( |
|
236 | + 'name' => esc_html__( 'Strong Tertiary Color', 'lsx-customizer' ), |
|
237 | + 'slug' => 'strong-tertiary-color', |
|
238 | + 'color' => get_theme_mod( 'strong_tertiary_color', '#3F640B' ), |
|
239 | + ), |
|
240 | + array( |
|
241 | + 'name' => esc_html__( 'White', 'lsx-customizer' ), |
|
242 | + 'slug' => 'white', |
|
243 | + 'color' => '#ffffff', |
|
244 | + ), |
|
245 | + array( |
|
246 | + 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
247 | + 'slug' => 'black', |
|
248 | + 'color' => '#000000', |
|
249 | + ), |
|
250 | + )); |
|
251 | + } |
|
252 | + |
|
253 | + } |
|
254 | + |
|
255 | + new LSX_Customizer_Frontend(); |
|
256 | 256 | |
257 | 257 | } |
@@ -1,53 +1,53 @@ |
||
1 | 1 | <?php |
2 | 2 | if ( ! class_exists( 'LSX_Customizer_Core' ) ) { |
3 | 3 | |
4 | - /** |
|
5 | - * LSX Customizer Core Class |
|
6 | - * |
|
7 | - * @package LSX Customizer |
|
8 | - * @author LightSpeed |
|
9 | - * @license GPL3 |
|
10 | - * @link |
|
11 | - * @copyright 2016 LightSpeed |
|
12 | - */ |
|
13 | - class LSX_Customizer_Core extends LSX_Customizer { |
|
4 | + /** |
|
5 | + * LSX Customizer Core Class |
|
6 | + * |
|
7 | + * @package LSX Customizer |
|
8 | + * @author LightSpeed |
|
9 | + * @license GPL3 |
|
10 | + * @link |
|
11 | + * @copyright 2016 LightSpeed |
|
12 | + */ |
|
13 | + class LSX_Customizer_Core extends LSX_Customizer { |
|
14 | 14 | |
15 | - /** |
|
16 | - * Constructor. |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - */ |
|
20 | - public function __construct() { |
|
21 | - add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
22 | - } |
|
15 | + /** |
|
16 | + * Constructor. |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + */ |
|
20 | + public function __construct() { |
|
21 | + add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Customizer Controls and Settings. |
|
26 | - * |
|
27 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
28 | - * @since 1.0.0 |
|
29 | - */ |
|
30 | - public function customize_register( $wp_customize ) { |
|
31 | - /** |
|
32 | - * Core section: Theme Credit |
|
33 | - */ |
|
34 | - $wp_customize->add_setting( 'lsx_theme_credit_status', array( |
|
35 | - 'default' => true, |
|
36 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
37 | - ) ); |
|
24 | + /** |
|
25 | + * Customizer Controls and Settings. |
|
26 | + * |
|
27 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
28 | + * @since 1.0.0 |
|
29 | + */ |
|
30 | + public function customize_register( $wp_customize ) { |
|
31 | + /** |
|
32 | + * Core section: Theme Credit |
|
33 | + */ |
|
34 | + $wp_customize->add_setting( 'lsx_theme_credit_status', array( |
|
35 | + 'default' => true, |
|
36 | + 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
37 | + ) ); |
|
38 | 38 | |
39 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_theme_credit_status', array( |
|
40 | - 'label' => esc_html__( 'Theme Credit', 'lsx-customizer' ), |
|
41 | - // 'description' => esc_html__( 'Displays theme credit in footer.', 'lsx-customizer' ), |
|
42 | - 'section' => 'lsx-layout', |
|
43 | - 'settings' => 'lsx_theme_credit_status', |
|
44 | - 'type' => 'checkbox', |
|
45 | - 'priority' => 10, |
|
46 | - ) ) ); |
|
47 | - } |
|
39 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_theme_credit_status', array( |
|
40 | + 'label' => esc_html__( 'Theme Credit', 'lsx-customizer' ), |
|
41 | + // 'description' => esc_html__( 'Displays theme credit in footer.', 'lsx-customizer' ), |
|
42 | + 'section' => 'lsx-layout', |
|
43 | + 'settings' => 'lsx_theme_credit_status', |
|
44 | + 'type' => 'checkbox', |
|
45 | + 'priority' => 10, |
|
46 | + ) ) ); |
|
47 | + } |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - new LSX_Customizer_Core(); |
|
51 | + new LSX_Customizer_Core(); |
|
52 | 52 | |
53 | 53 | } |