1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Enqueues the editor styles. |
5
|
|
|
* |
6
|
|
|
* @return void |
7
|
|
|
*/ |
8
|
|
|
function editor_styles() { |
9
|
|
|
|
10
|
|
|
// Enqueue shared editor styles. |
11
|
|
|
add_editor_style( |
12
|
|
|
'/assets/css/admin/gutenberg-admin.css' |
13
|
|
|
); |
14
|
|
|
add_editor_style( |
15
|
|
|
'/assets/css/yoast/yoast.css' |
16
|
|
|
); |
17
|
|
|
|
18
|
|
|
} |
19
|
|
|
add_action( 'admin_init', 'editor_styles' ); |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Add theme support functions. |
23
|
|
|
* |
24
|
|
|
* @package lsx |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
if ( ! function_exists( 'theme_support' ) ) : |
28
|
|
|
/** |
29
|
|
|
* Add theme support functions. |
30
|
|
|
* |
31
|
|
|
* @return void |
32
|
|
|
*/ |
33
|
|
|
function theme_support() { |
34
|
|
|
// Add support for editor styles. |
35
|
|
|
add_theme_support( 'editor-styles' ); |
36
|
|
|
// Add support for full and wide align images. |
37
|
|
|
add_theme_support( 'align-wide' ); |
38
|
|
|
// Add support for styling blocks. |
39
|
|
|
add_theme_support( 'wp-block-styles' ); |
40
|
|
|
// Add support for responsive embedded content. |
41
|
|
|
add_theme_support( 'responsive-embeds' ); |
42
|
|
|
// Add support for Custom Line Heights. |
43
|
|
|
add_theme_support( 'custom-line-height' ); |
44
|
|
|
// Add support for Custom Units. |
45
|
|
|
add_theme_support( 'custom-units' ); |
46
|
|
|
// Add support for experimental link colors. |
47
|
|
|
add_theme_support( 'experimental-link-color' ); |
48
|
|
|
// Add custom editor font sizes. |
49
|
|
|
add_theme_support( |
50
|
|
|
'editor-font-sizes', |
51
|
|
|
array( |
52
|
|
|
array( |
53
|
|
|
'name' => esc_html_x( 'Small', 'font size option label', 'lsx' ), |
54
|
|
|
'shortName' => esc_html_x( 'S', 'abbreviation of the font size option label', 'lsx' ), |
55
|
|
|
'size' => 13, |
56
|
|
|
'slug' => 'small', |
57
|
|
|
), |
58
|
|
|
array( |
59
|
|
|
'name' => esc_html_x( 'Normal', 'font size option label', 'lsx' ), |
60
|
|
|
'shortName' => esc_html_x( 'N', 'abbreviation of the font size option label', 'lsx' ), |
61
|
|
|
'size' => 15, |
62
|
|
|
'slug' => 'normal', |
63
|
|
|
), |
64
|
|
|
array( |
65
|
|
|
'name' => esc_html_x( 'Medium', 'font size option label', 'lsx' ), |
66
|
|
|
'shortName' => esc_html_x( 'M', 'abbreviation of the font size option label', 'lsx' ), |
67
|
|
|
'size' => 22, |
68
|
|
|
'slug' => 'medium', |
69
|
|
|
), |
70
|
|
|
array( |
71
|
|
|
'name' => esc_html_x( 'Large', 'font size option label', 'lsx' ), |
72
|
|
|
'shortName' => esc_html_x( 'L', 'abbreviation of the font size option label', 'lsx' ), |
73
|
|
|
'size' => 30, |
74
|
|
|
'slug' => 'large', |
75
|
|
|
), |
76
|
|
|
array( |
77
|
|
|
'name' => esc_html_x( 'Huge', 'font size option label', 'lsx' ), |
78
|
|
|
'shortName' => esc_html_x( 'XL', 'abbreviation of the font size option label', 'lsx' ), |
79
|
|
|
'size' => 40, |
80
|
|
|
'slug' => 'huge', |
81
|
|
|
), |
82
|
|
|
) |
83
|
|
|
); |
84
|
|
|
|
85
|
|
|
// Add support for custom color scheme. |
86
|
|
|
add_theme_support( 'editor-color-palette', array( |
|
|
|
|
87
|
|
|
array( |
88
|
|
|
'name' => __( 'Strong Blue', 'lsx' ), |
89
|
|
|
'slug' => 'strong-blue', |
90
|
|
|
'color' => '#27639e', |
91
|
|
|
), |
92
|
|
|
array( |
93
|
|
|
'name' => __( 'Lighter Blue', 'lsx' ), |
94
|
|
|
'slug' => 'lighter-blue', |
95
|
|
|
'color' => '#428bca', |
96
|
|
|
), |
97
|
|
|
array( |
98
|
|
|
'name' => __( 'Yellow', 'lsx' ), |
99
|
|
|
'slug' => 'light-yellow', |
100
|
|
|
'color' => '#f7ae00', |
101
|
|
|
), |
102
|
|
|
array( |
103
|
|
|
'name' => __( 'Dark Yellow', 'lsx' ), |
104
|
|
|
'slug' => 'dark-yellow', |
105
|
|
|
'color' => '#ab7800', |
106
|
|
|
), |
107
|
|
|
array( |
108
|
|
|
'name' => __( 'Green', 'lsx' ), |
109
|
|
|
'slug' => 'light-green', |
110
|
|
|
'color' => '#6BA913', |
111
|
|
|
), |
112
|
|
|
array( |
113
|
|
|
'name' => __( 'Dark Green', 'lsx' ), |
114
|
|
|
'slug' => 'dark-green', |
115
|
|
|
'color' => '#3F640B', |
116
|
|
|
), |
117
|
|
|
array( |
118
|
|
|
'name' => __( 'White', 'lsx' ), |
119
|
|
|
'slug' => 'white', |
120
|
|
|
'color' => '#ffffff', |
121
|
|
|
), |
122
|
|
|
array( |
123
|
|
|
'name' => __( 'Black', 'lsx' ), |
124
|
|
|
'slug' => 'black', |
125
|
|
|
'color' => '#000000', |
126
|
|
|
), |
127
|
|
|
) ); |
|
|
|
|
128
|
|
|
|
129
|
|
|
$primary_color = 'rgba(39,99,158,1)'; |
130
|
|
|
$secondary_color = 'rgba(247,174,0,1)'; |
131
|
|
|
$tertiary_color = 'rgba(107,169,19,1)'; |
132
|
|
|
$background_color = 'rgba(249,249,249,1)'; |
133
|
|
|
|
134
|
|
|
add_theme_support( |
135
|
|
|
'editor-gradient-presets', |
136
|
|
|
array( |
137
|
|
|
array( |
138
|
|
|
'name' => __( 'Primary to Secondary', 'lsx' ), |
139
|
|
|
'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $secondary_color ) . ' 100%)', |
140
|
|
|
'slug' => 'primary-to-secondary', |
141
|
|
|
), |
142
|
|
|
array( |
143
|
|
|
'name' => __( 'Primary to Tertiary', 'lsx' ), |
144
|
|
|
'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
145
|
|
|
'slug' => 'primary-to-tertiary', |
146
|
|
|
), |
147
|
|
|
array( |
148
|
|
|
'name' => __( 'Primary to Background', 'lsx' ), |
149
|
|
|
'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $background_color ) . ' 100%)', |
150
|
|
|
'slug' => 'primary-to-background', |
151
|
|
|
), |
152
|
|
|
array( |
153
|
|
|
'name' => __( 'Secondary to Tertiary', 'lsx' ), |
154
|
|
|
'gradient' => 'linear-gradient(135deg, ' . esc_attr( $secondary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
155
|
|
|
'slug' => 'secondary-to-tertiary', |
156
|
|
|
), |
157
|
|
|
) |
158
|
|
|
); |
159
|
|
|
} |
160
|
|
|
endif; |
161
|
|
|
add_action( 'after_setup_theme', 'theme_support' ); |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* WPForms submit button, match Gutenberg button block |
165
|
|
|
* |
166
|
|
|
* @param [type] $form_data |
|
|
|
|
167
|
|
|
* @return void |
|
|
|
|
168
|
|
|
*/ |
169
|
|
|
function lsx_wpforms_match_button_block( $form_data ) { |
170
|
|
|
$form_data['settings']['submit_class'] .= ' btn'; |
171
|
|
|
return $form_data; |
172
|
|
|
} |
173
|
|
|
add_filter( 'wpforms_frontend_form_data', 'lsx_wpforms_match_button_block' ); |
174
|
|
|
|