@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | |
17 | 17 | <?php |
18 | 18 | |
19 | - if ( have_posts() ) { |
|
19 | + if (have_posts()) { |
|
20 | 20 | |
21 | - while ( have_posts() ) { |
|
21 | + while (have_posts()) { |
|
22 | 22 | the_post(); |
23 | 23 | |
24 | - get_template_part( 'template-parts/content', get_post_type() ); |
|
24 | + get_template_part('template-parts/content', get_post_type()); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
@@ -29,6 +29,6 @@ discard block |
||
29 | 29 | |
30 | 30 | </main><!-- #site-content --> |
31 | 31 | |
32 | -<?php get_template_part( 'template-parts/footer-menus-widgets' ); ?> |
|
32 | +<?php get_template_part('template-parts/footer-menus-widgets'); ?> |
|
33 | 33 | |
34 | 34 | <?php get_footer(); ?> |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // This theme requires WordPress 5.3 or later. |
13 | -if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) { |
|
14 | - require get_template_directory() . '/inc/back-compat.php'; |
|
13 | +if (version_compare($GLOBALS['wp_version'], '5.3', '<')) { |
|
14 | + require get_template_directory().'/inc/back-compat.php'; |
|
15 | 15 | } |
16 | 16 | |
17 | -if ( ! function_exists( 'twenty_twenty_one_setup' ) ) { |
|
17 | +if ( ! function_exists('twenty_twenty_one_setup')) { |
|
18 | 18 | /** |
19 | 19 | * Sets up theme defaults and registers support for various WordPress features. |
20 | 20 | * |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | * If you're building a theme based on Twenty Twenty-One, use a find and replace |
34 | 34 | * to change 'twentytwentyone' to the name of your theme in all the template files. |
35 | 35 | */ |
36 | - load_theme_textdomain( 'twentytwentyone', get_template_directory() . '/languages' ); |
|
36 | + load_theme_textdomain('twentytwentyone', get_template_directory().'/languages'); |
|
37 | 37 | |
38 | 38 | // Add default posts and comments RSS feed links to head. |
39 | - add_theme_support( 'automatic-feed-links' ); |
|
39 | + add_theme_support('automatic-feed-links'); |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * Let WordPress manage the document title. |
43 | 43 | * This theme does not use a hard-coded <title> tag in the document head, |
44 | 44 | * WordPress will provide it for us. |
45 | 45 | */ |
46 | - add_theme_support( 'title-tag' ); |
|
46 | + add_theme_support('title-tag'); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Add post-formats support. |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ |
70 | 70 | */ |
71 | - add_theme_support( 'post-thumbnails' ); |
|
72 | - set_post_thumbnail_size( 1568, 9999 ); |
|
71 | + add_theme_support('post-thumbnails'); |
|
72 | + set_post_thumbnail_size(1568, 9999); |
|
73 | 73 | |
74 | 74 | register_nav_menus( |
75 | 75 | array( |
76 | - 'primary' => esc_html__( 'Primary menu', 'twentytwentyone' ), |
|
77 | - 'footer' => esc_html__( 'Secondary menu', 'twentytwentyone' ), |
|
76 | + 'primary' => esc_html__('Primary menu', 'twentytwentyone'), |
|
77 | + 'footer' => esc_html__('Secondary menu', 'twentytwentyone'), |
|
78 | 78 | ) |
79 | 79 | ); |
80 | 80 | |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | ); |
116 | 116 | |
117 | 117 | // Add theme support for selective refresh for widgets. |
118 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
118 | + add_theme_support('customize-selective-refresh-widgets'); |
|
119 | 119 | |
120 | 120 | // Add support for Block Styles. |
121 | - add_theme_support( 'wp-block-styles' ); |
|
121 | + add_theme_support('wp-block-styles'); |
|
122 | 122 | |
123 | 123 | // Add support for full and wide align images. |
124 | - add_theme_support( 'align-wide' ); |
|
124 | + add_theme_support('align-wide'); |
|
125 | 125 | |
126 | 126 | // Add support for editor styles. |
127 | - add_theme_support( 'editor-styles' ); |
|
128 | - $background_color = get_theme_mod( 'background_color', 'D1E4DD' ); |
|
129 | - if ( 127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) { |
|
130 | - add_theme_support( 'dark-editor-style' ); |
|
127 | + add_theme_support('editor-styles'); |
|
128 | + $background_color = get_theme_mod('background_color', 'D1E4DD'); |
|
129 | + if (127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex($background_color)) { |
|
130 | + add_theme_support('dark-editor-style'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | $editor_stylesheet_path = './assets/css/style-editor.css'; |
@@ -135,56 +135,56 @@ discard block |
||
135 | 135 | // Note, the is_IE global variable is defined by WordPress and is used |
136 | 136 | // to detect if the current browser is internet explorer. |
137 | 137 | global $is_IE; |
138 | - if ( $is_IE ) { |
|
138 | + if ($is_IE) { |
|
139 | 139 | $editor_stylesheet_path = './assets/css/ie-editor.css'; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Enqueue editor styles. |
143 | - add_editor_style( $editor_stylesheet_path ); |
|
143 | + add_editor_style($editor_stylesheet_path); |
|
144 | 144 | |
145 | 145 | // Add custom editor font sizes. |
146 | 146 | add_theme_support( |
147 | 147 | 'editor-font-sizes', |
148 | 148 | array( |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Extra small', 'twentytwentyone' ), |
|
151 | - 'shortName' => esc_html_x( 'XS', 'Font size', 'twentytwentyone' ), |
|
150 | + 'name' => esc_html__('Extra small', 'twentytwentyone'), |
|
151 | + 'shortName' => esc_html_x('XS', 'Font size', 'twentytwentyone'), |
|
152 | 152 | 'size' => 16, |
153 | 153 | 'slug' => 'extra-small', |
154 | 154 | ), |
155 | 155 | array( |
156 | - 'name' => esc_html__( 'Small', 'twentytwentyone' ), |
|
157 | - 'shortName' => esc_html_x( 'S', 'Font size', 'twentytwentyone' ), |
|
156 | + 'name' => esc_html__('Small', 'twentytwentyone'), |
|
157 | + 'shortName' => esc_html_x('S', 'Font size', 'twentytwentyone'), |
|
158 | 158 | 'size' => 18, |
159 | 159 | 'slug' => 'small', |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => esc_html__( 'Normal', 'twentytwentyone' ), |
|
163 | - 'shortName' => esc_html_x( 'M', 'Font size', 'twentytwentyone' ), |
|
162 | + 'name' => esc_html__('Normal', 'twentytwentyone'), |
|
163 | + 'shortName' => esc_html_x('M', 'Font size', 'twentytwentyone'), |
|
164 | 164 | 'size' => 20, |
165 | 165 | 'slug' => 'normal', |
166 | 166 | ), |
167 | 167 | array( |
168 | - 'name' => esc_html__( 'Large', 'twentytwentyone' ), |
|
169 | - 'shortName' => esc_html_x( 'L', 'Font size', 'twentytwentyone' ), |
|
168 | + 'name' => esc_html__('Large', 'twentytwentyone'), |
|
169 | + 'shortName' => esc_html_x('L', 'Font size', 'twentytwentyone'), |
|
170 | 170 | 'size' => 24, |
171 | 171 | 'slug' => 'large', |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => esc_html__( 'Extra large', 'twentytwentyone' ), |
|
175 | - 'shortName' => esc_html_x( 'XL', 'Font size', 'twentytwentyone' ), |
|
174 | + 'name' => esc_html__('Extra large', 'twentytwentyone'), |
|
175 | + 'shortName' => esc_html_x('XL', 'Font size', 'twentytwentyone'), |
|
176 | 176 | 'size' => 40, |
177 | 177 | 'slug' => 'extra-large', |
178 | 178 | ), |
179 | 179 | array( |
180 | - 'name' => esc_html__( 'Huge', 'twentytwentyone' ), |
|
181 | - 'shortName' => esc_html_x( 'XXL', 'Font size', 'twentytwentyone' ), |
|
180 | + 'name' => esc_html__('Huge', 'twentytwentyone'), |
|
181 | + 'shortName' => esc_html_x('XXL', 'Font size', 'twentytwentyone'), |
|
182 | 182 | 'size' => 96, |
183 | 183 | 'slug' => 'huge', |
184 | 184 | ), |
185 | 185 | array( |
186 | - 'name' => esc_html__( 'Gigantic', 'twentytwentyone' ), |
|
187 | - 'shortName' => esc_html_x( 'XXXL', 'Font size', 'twentytwentyone' ), |
|
186 | + 'name' => esc_html__('Gigantic', 'twentytwentyone'), |
|
187 | + 'shortName' => esc_html_x('XXXL', 'Font size', 'twentytwentyone'), |
|
188 | 188 | 'size' => 144, |
189 | 189 | 'slug' => 'gigantic', |
190 | 190 | ), |
@@ -215,52 +215,52 @@ discard block |
||
215 | 215 | 'editor-color-palette', |
216 | 216 | array( |
217 | 217 | array( |
218 | - 'name' => esc_html__( 'Black', 'twentytwentyone' ), |
|
218 | + 'name' => esc_html__('Black', 'twentytwentyone'), |
|
219 | 219 | 'slug' => 'black', |
220 | 220 | 'color' => $black, |
221 | 221 | ), |
222 | 222 | array( |
223 | - 'name' => esc_html__( 'Dark gray', 'twentytwentyone' ), |
|
223 | + 'name' => esc_html__('Dark gray', 'twentytwentyone'), |
|
224 | 224 | 'slug' => 'dark-gray', |
225 | 225 | 'color' => $dark_gray, |
226 | 226 | ), |
227 | 227 | array( |
228 | - 'name' => esc_html__( 'Gray', 'twentytwentyone' ), |
|
228 | + 'name' => esc_html__('Gray', 'twentytwentyone'), |
|
229 | 229 | 'slug' => 'gray', |
230 | 230 | 'color' => $gray, |
231 | 231 | ), |
232 | 232 | array( |
233 | - 'name' => esc_html__( 'Green', 'twentytwentyone' ), |
|
233 | + 'name' => esc_html__('Green', 'twentytwentyone'), |
|
234 | 234 | 'slug' => 'green', |
235 | 235 | 'color' => $green, |
236 | 236 | ), |
237 | 237 | array( |
238 | - 'name' => esc_html__( 'Blue', 'twentytwentyone' ), |
|
238 | + 'name' => esc_html__('Blue', 'twentytwentyone'), |
|
239 | 239 | 'slug' => 'blue', |
240 | 240 | 'color' => $blue, |
241 | 241 | ), |
242 | 242 | array( |
243 | - 'name' => esc_html__( 'Purple', 'twentytwentyone' ), |
|
243 | + 'name' => esc_html__('Purple', 'twentytwentyone'), |
|
244 | 244 | 'slug' => 'purple', |
245 | 245 | 'color' => $purple, |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => esc_html__( 'Red', 'twentytwentyone' ), |
|
248 | + 'name' => esc_html__('Red', 'twentytwentyone'), |
|
249 | 249 | 'slug' => 'red', |
250 | 250 | 'color' => $red, |
251 | 251 | ), |
252 | 252 | array( |
253 | - 'name' => esc_html__( 'Orange', 'twentytwentyone' ), |
|
253 | + 'name' => esc_html__('Orange', 'twentytwentyone'), |
|
254 | 254 | 'slug' => 'orange', |
255 | 255 | 'color' => $orange, |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'name' => esc_html__( 'Yellow', 'twentytwentyone' ), |
|
258 | + 'name' => esc_html__('Yellow', 'twentytwentyone'), |
|
259 | 259 | 'slug' => 'yellow', |
260 | 260 | 'color' => $yellow, |
261 | 261 | ), |
262 | 262 | array( |
263 | - 'name' => esc_html__( 'White', 'twentytwentyone' ), |
|
263 | + 'name' => esc_html__('White', 'twentytwentyone'), |
|
264 | 264 | 'slug' => 'white', |
265 | 265 | 'color' => $white, |
266 | 266 | ), |
@@ -271,43 +271,43 @@ discard block |
||
271 | 271 | 'editor-gradient-presets', |
272 | 272 | array( |
273 | 273 | array( |
274 | - 'name' => esc_html__( 'Purple to yellow', 'twentytwentyone' ), |
|
275 | - 'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $yellow . ' 100%)', |
|
274 | + 'name' => esc_html__('Purple to yellow', 'twentytwentyone'), |
|
275 | + 'gradient' => 'linear-gradient(160deg, '.$purple.' 0%, '.$yellow.' 100%)', |
|
276 | 276 | 'slug' => 'purple-to-yellow', |
277 | 277 | ), |
278 | 278 | array( |
279 | - 'name' => esc_html__( 'Yellow to purple', 'twentytwentyone' ), |
|
280 | - 'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $purple . ' 100%)', |
|
279 | + 'name' => esc_html__('Yellow to purple', 'twentytwentyone'), |
|
280 | + 'gradient' => 'linear-gradient(160deg, '.$yellow.' 0%, '.$purple.' 100%)', |
|
281 | 281 | 'slug' => 'yellow-to-purple', |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'name' => esc_html__( 'Green to yellow', 'twentytwentyone' ), |
|
285 | - 'gradient' => 'linear-gradient(160deg, ' . $green . ' 0%, ' . $yellow . ' 100%)', |
|
284 | + 'name' => esc_html__('Green to yellow', 'twentytwentyone'), |
|
285 | + 'gradient' => 'linear-gradient(160deg, '.$green.' 0%, '.$yellow.' 100%)', |
|
286 | 286 | 'slug' => 'green-to-yellow', |
287 | 287 | ), |
288 | 288 | array( |
289 | - 'name' => esc_html__( 'Yellow to green', 'twentytwentyone' ), |
|
290 | - 'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $green . ' 100%)', |
|
289 | + 'name' => esc_html__('Yellow to green', 'twentytwentyone'), |
|
290 | + 'gradient' => 'linear-gradient(160deg, '.$yellow.' 0%, '.$green.' 100%)', |
|
291 | 291 | 'slug' => 'yellow-to-green', |
292 | 292 | ), |
293 | 293 | array( |
294 | - 'name' => esc_html__( 'Red to yellow', 'twentytwentyone' ), |
|
295 | - 'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $yellow . ' 100%)', |
|
294 | + 'name' => esc_html__('Red to yellow', 'twentytwentyone'), |
|
295 | + 'gradient' => 'linear-gradient(160deg, '.$red.' 0%, '.$yellow.' 100%)', |
|
296 | 296 | 'slug' => 'red-to-yellow', |
297 | 297 | ), |
298 | 298 | array( |
299 | - 'name' => esc_html__( 'Yellow to red', 'twentytwentyone' ), |
|
300 | - 'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $red . ' 100%)', |
|
299 | + 'name' => esc_html__('Yellow to red', 'twentytwentyone'), |
|
300 | + 'gradient' => 'linear-gradient(160deg, '.$yellow.' 0%, '.$red.' 100%)', |
|
301 | 301 | 'slug' => 'yellow-to-red', |
302 | 302 | ), |
303 | 303 | array( |
304 | - 'name' => esc_html__( 'Purple to red', 'twentytwentyone' ), |
|
305 | - 'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $red . ' 100%)', |
|
304 | + 'name' => esc_html__('Purple to red', 'twentytwentyone'), |
|
305 | + 'gradient' => 'linear-gradient(160deg, '.$purple.' 0%, '.$red.' 100%)', |
|
306 | 306 | 'slug' => 'purple-to-red', |
307 | 307 | ), |
308 | 308 | array( |
309 | - 'name' => esc_html__( 'Red to purple', 'twentytwentyone' ), |
|
310 | - 'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $purple . ' 100%)', |
|
309 | + 'name' => esc_html__('Red to purple', 'twentytwentyone'), |
|
310 | + 'gradient' => 'linear-gradient(160deg, '.$red.' 0%, '.$purple.' 100%)', |
|
311 | 311 | 'slug' => 'red-to-purple', |
312 | 312 | ), |
313 | 313 | ) |
@@ -318,32 +318,32 @@ discard block |
||
318 | 318 | * This is done conditionally to avoid loading the starter content on every |
319 | 319 | * page load, as it is a one-off operation only needed once in the customizer. |
320 | 320 | */ |
321 | - if ( is_customize_preview() ) { |
|
322 | - require get_template_directory() . '/inc/starter-content.php'; |
|
323 | - add_theme_support( 'starter-content', twenty_twenty_one_get_starter_content() ); |
|
321 | + if (is_customize_preview()) { |
|
322 | + require get_template_directory().'/inc/starter-content.php'; |
|
323 | + add_theme_support('starter-content', twenty_twenty_one_get_starter_content()); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | // Add support for responsive embedded content. |
327 | - add_theme_support( 'responsive-embeds' ); |
|
327 | + add_theme_support('responsive-embeds'); |
|
328 | 328 | |
329 | 329 | // Add support for custom line height controls. |
330 | - add_theme_support( 'custom-line-height' ); |
|
330 | + add_theme_support('custom-line-height'); |
|
331 | 331 | |
332 | 332 | // Add support for experimental link color control. |
333 | - add_theme_support( 'experimental-link-color' ); |
|
333 | + add_theme_support('experimental-link-color'); |
|
334 | 334 | |
335 | 335 | // Add support for experimental cover block spacing. |
336 | - add_theme_support( 'custom-spacing' ); |
|
336 | + add_theme_support('custom-spacing'); |
|
337 | 337 | |
338 | 338 | // Add support for custom units. |
339 | 339 | // This was removed in WordPress 5.6 but is still required to properly support WP 5.5. |
340 | - add_theme_support( 'custom-units' ); |
|
340 | + add_theme_support('custom-units'); |
|
341 | 341 | |
342 | 342 | // Remove feed icon link from legacy RSS widget. |
343 | - add_filter( 'rss_widget_feed_link', '__return_false' ); |
|
343 | + add_filter('rss_widget_feed_link', '__return_false'); |
|
344 | 344 | } |
345 | 345 | } |
346 | -add_action( 'after_setup_theme', 'twenty_twenty_one_setup' ); |
|
346 | +add_action('after_setup_theme', 'twenty_twenty_one_setup'); |
|
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Register widget area. |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | |
359 | 359 | register_sidebar( |
360 | 360 | array( |
361 | - 'name' => esc_html__( 'Footer', 'twentytwentyone' ), |
|
361 | + 'name' => esc_html__('Footer', 'twentytwentyone'), |
|
362 | 362 | 'id' => 'sidebar-1', |
363 | - 'description' => esc_html__( 'Add widgets here to appear in your footer.', 'twentytwentyone' ), |
|
363 | + 'description' => esc_html__('Add widgets here to appear in your footer.', 'twentytwentyone'), |
|
364 | 364 | 'before_widget' => '<section id="%1$s" class="widget %2$s">', |
365 | 365 | 'after_widget' => '</section>', |
366 | 366 | 'before_title' => '<h2 class="widget-title">', |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | ) |
369 | 369 | ); |
370 | 370 | } |
371 | -add_action( 'widgets_init', 'twenty_twenty_one_widgets_init' ); |
|
371 | +add_action('widgets_init', 'twenty_twenty_one_widgets_init'); |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Set the content width in pixels, based on the theme's design and stylesheet. |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | // This variable is intended to be overruled from themes. |
386 | 386 | // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. |
387 | 387 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
388 | - $GLOBALS['content_width'] = apply_filters( 'twenty_twenty_one_content_width', 750 ); |
|
388 | + $GLOBALS['content_width'] = apply_filters('twenty_twenty_one_content_width', 750); |
|
389 | 389 | } |
390 | -add_action( 'after_setup_theme', 'twenty_twenty_one_content_width', 0 ); |
|
390 | +add_action('after_setup_theme', 'twenty_twenty_one_content_width', 0); |
|
391 | 391 | |
392 | 392 | /** |
393 | 393 | * Enqueue scripts and styles. |
@@ -400,31 +400,31 @@ discard block |
||
400 | 400 | // Note, the is_IE global variable is defined by WordPress and is used |
401 | 401 | // to detect if the current browser is internet explorer. |
402 | 402 | global $is_IE, $wp_scripts; |
403 | - if ( $is_IE ) { |
|
403 | + if ($is_IE) { |
|
404 | 404 | // If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables. |
405 | - wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) ); |
|
405 | + wp_enqueue_style('twenty-twenty-one-style', get_template_directory_uri().'/assets/css/ie.css', array(), wp_get_theme()->get('Version')); |
|
406 | 406 | } else { |
407 | 407 | // If not IE, use the standard stylesheet. |
408 | - wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); |
|
408 | + wp_enqueue_style('twenty-twenty-one-style', get_template_directory_uri().'/style.css', array(), wp_get_theme()->get('Version')); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | // RTL styles. |
412 | - wp_style_add_data( 'twenty-twenty-one-style', 'rtl', 'replace' ); |
|
412 | + wp_style_add_data('twenty-twenty-one-style', 'rtl', 'replace'); |
|
413 | 413 | |
414 | 414 | // Print styles. |
415 | - wp_enqueue_style( 'twenty-twenty-one-print-style', get_template_directory_uri() . '/assets/css/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); |
|
415 | + wp_enqueue_style('twenty-twenty-one-print-style', get_template_directory_uri().'/assets/css/print.css', array(), wp_get_theme()->get('Version'), 'print'); |
|
416 | 416 | |
417 | 417 | // Threaded comment reply styles. |
418 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
419 | - wp_enqueue_script( 'comment-reply' ); |
|
418 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
419 | + wp_enqueue_script('comment-reply'); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // Register the IE11 polyfill file. |
423 | 423 | wp_register_script( |
424 | 424 | 'twenty-twenty-one-ie11-polyfills-asset', |
425 | - get_template_directory_uri() . '/assets/js/polyfills.js', |
|
425 | + get_template_directory_uri().'/assets/js/polyfills.js', |
|
426 | 426 | array(), |
427 | - wp_get_theme()->get( 'Version' ), |
|
427 | + wp_get_theme()->get('Version'), |
|
428 | 428 | true |
429 | 429 | ); |
430 | 430 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | 'twenty-twenty-one-ie11-polyfills', |
434 | 434 | null, |
435 | 435 | array(), |
436 | - wp_get_theme()->get( 'Version' ), |
|
436 | + wp_get_theme()->get('Version'), |
|
437 | 437 | true |
438 | 438 | ); |
439 | 439 | wp_add_inline_script( |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | ); |
448 | 448 | |
449 | 449 | // Main navigation scripts. |
450 | - if ( has_nav_menu( 'primary' ) ) { |
|
450 | + if (has_nav_menu('primary')) { |
|
451 | 451 | wp_enqueue_script( |
452 | 452 | 'twenty-twenty-one-primary-navigation-script', |
453 | - get_template_directory_uri() . '/assets/js/primary-navigation.js', |
|
454 | - array( 'twenty-twenty-one-ie11-polyfills' ), |
|
455 | - wp_get_theme()->get( 'Version' ), |
|
453 | + get_template_directory_uri().'/assets/js/primary-navigation.js', |
|
454 | + array('twenty-twenty-one-ie11-polyfills'), |
|
455 | + wp_get_theme()->get('Version'), |
|
456 | 456 | true |
457 | 457 | ); |
458 | 458 | } |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | // Responsive embeds script. |
461 | 461 | wp_enqueue_script( |
462 | 462 | 'twenty-twenty-one-responsive-embeds-script', |
463 | - get_template_directory_uri() . '/assets/js/responsive-embeds.js', |
|
464 | - array( 'twenty-twenty-one-ie11-polyfills' ), |
|
465 | - wp_get_theme()->get( 'Version' ), |
|
463 | + get_template_directory_uri().'/assets/js/responsive-embeds.js', |
|
464 | + array('twenty-twenty-one-ie11-polyfills'), |
|
465 | + wp_get_theme()->get('Version'), |
|
466 | 466 | true |
467 | 467 | ); |
468 | 468 | } |
469 | -add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_scripts' ); |
|
469 | +add_action('wp_enqueue_scripts', 'twenty_twenty_one_scripts'); |
|
470 | 470 | |
471 | 471 | /** |
472 | 472 | * Enqueue block editor script. |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | */ |
478 | 478 | function twentytwentyone_block_editor_script() { |
479 | 479 | |
480 | - wp_enqueue_script( 'twentytwentyone-editor', get_theme_file_uri( '/assets/js/editor.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true ); |
|
480 | + wp_enqueue_script('twentytwentyone-editor', get_theme_file_uri('/assets/js/editor.js'), array('wp-blocks', 'wp-dom'), wp_get_theme()->get('Version'), true); |
|
481 | 481 | } |
482 | 482 | |
483 | -add_action( 'enqueue_block_editor_assets', 'twentytwentyone_block_editor_script' ); |
|
483 | +add_action('enqueue_block_editor_assets', 'twentytwentyone_block_editor_script'); |
|
484 | 484 | |
485 | 485 | /** |
486 | 486 | * Fix skip link focus in IE11. |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | function twenty_twenty_one_skip_link_focus_fix() { |
496 | 496 | |
497 | 497 | // If SCRIPT_DEBUG is defined and true, print the unminified file. |
498 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
498 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
499 | 499 | echo '<script>'; |
500 | - include get_template_directory() . '/assets/js/skip-link-focus-fix.js'; |
|
500 | + include get_template_directory().'/assets/js/skip-link-focus-fix.js'; |
|
501 | 501 | echo '</script>'; |
502 | 502 | } else { |
503 | 503 | // The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`. |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | <?php |
509 | 509 | } |
510 | 510 | } |
511 | -add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' ); |
|
511 | +add_action('wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix'); |
|
512 | 512 | |
513 | 513 | /** |
514 | 514 | * Enqueue non-latin language styles. |
@@ -518,42 +518,42 @@ discard block |
||
518 | 518 | * @return void |
519 | 519 | */ |
520 | 520 | function twenty_twenty_one_non_latin_languages() { |
521 | - $custom_css = twenty_twenty_one_get_non_latin_css( 'front-end' ); |
|
521 | + $custom_css = twenty_twenty_one_get_non_latin_css('front-end'); |
|
522 | 522 | |
523 | - if ( $custom_css ) { |
|
524 | - wp_add_inline_style( 'twenty-twenty-one-style', $custom_css ); |
|
523 | + if ($custom_css) { |
|
524 | + wp_add_inline_style('twenty-twenty-one-style', $custom_css); |
|
525 | 525 | } |
526 | 526 | } |
527 | -add_action( 'wp_enqueue_scripts', 'twenty_twenty_one_non_latin_languages' ); |
|
527 | +add_action('wp_enqueue_scripts', 'twenty_twenty_one_non_latin_languages'); |
|
528 | 528 | |
529 | 529 | // SVG Icons class. |
530 | -require get_template_directory() . '/classes/class-twenty-twenty-one-svg-icons.php'; |
|
530 | +require get_template_directory().'/classes/class-twenty-twenty-one-svg-icons.php'; |
|
531 | 531 | |
532 | 532 | // Custom color classes. |
533 | -require get_template_directory() . '/classes/class-twenty-twenty-one-custom-colors.php'; |
|
533 | +require get_template_directory().'/classes/class-twenty-twenty-one-custom-colors.php'; |
|
534 | 534 | new Twenty_Twenty_One_Custom_Colors(); |
535 | 535 | |
536 | 536 | // Enhance the theme by hooking into WordPress. |
537 | -require get_template_directory() . '/inc/template-functions.php'; |
|
537 | +require get_template_directory().'/inc/template-functions.php'; |
|
538 | 538 | |
539 | 539 | // Menu functions and filters. |
540 | -require get_template_directory() . '/inc/menu-functions.php'; |
|
540 | +require get_template_directory().'/inc/menu-functions.php'; |
|
541 | 541 | |
542 | 542 | // Custom template tags for the theme. |
543 | -require get_template_directory() . '/inc/template-tags.php'; |
|
543 | +require get_template_directory().'/inc/template-tags.php'; |
|
544 | 544 | |
545 | 545 | // Customizer additions. |
546 | -require get_template_directory() . '/classes/class-twenty-twenty-one-customize.php'; |
|
546 | +require get_template_directory().'/classes/class-twenty-twenty-one-customize.php'; |
|
547 | 547 | new Twenty_Twenty_One_Customize(); |
548 | 548 | |
549 | 549 | // Block Patterns. |
550 | -require get_template_directory() . '/inc/block-patterns.php'; |
|
550 | +require get_template_directory().'/inc/block-patterns.php'; |
|
551 | 551 | |
552 | 552 | // Block Styles. |
553 | -require get_template_directory() . '/inc/block-styles.php'; |
|
553 | +require get_template_directory().'/inc/block-styles.php'; |
|
554 | 554 | |
555 | 555 | // Dark Mode. |
556 | -require_once get_template_directory() . '/classes/class-twenty-twenty-one-dark-mode.php'; |
|
556 | +require_once get_template_directory().'/classes/class-twenty-twenty-one-dark-mode.php'; |
|
557 | 557 | new Twenty_Twenty_One_Dark_Mode(); |
558 | 558 | |
559 | 559 | /** |
@@ -566,21 +566,21 @@ discard block |
||
566 | 566 | function twentytwentyone_customize_preview_init() { |
567 | 567 | wp_enqueue_script( |
568 | 568 | 'twentytwentyone-customize-helpers', |
569 | - get_theme_file_uri( '/assets/js/customize-helpers.js' ), |
|
569 | + get_theme_file_uri('/assets/js/customize-helpers.js'), |
|
570 | 570 | array(), |
571 | - wp_get_theme()->get( 'Version' ), |
|
571 | + wp_get_theme()->get('Version'), |
|
572 | 572 | true |
573 | 573 | ); |
574 | 574 | |
575 | 575 | wp_enqueue_script( |
576 | 576 | 'twentytwentyone-customize-preview', |
577 | - get_theme_file_uri( '/assets/js/customize-preview.js' ), |
|
578 | - array( 'customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers' ), |
|
579 | - wp_get_theme()->get( 'Version' ), |
|
577 | + get_theme_file_uri('/assets/js/customize-preview.js'), |
|
578 | + array('customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers'), |
|
579 | + wp_get_theme()->get('Version'), |
|
580 | 580 | true |
581 | 581 | ); |
582 | 582 | } |
583 | -add_action( 'customize_preview_init', 'twentytwentyone_customize_preview_init' ); |
|
583 | +add_action('customize_preview_init', 'twentytwentyone_customize_preview_init'); |
|
584 | 584 | |
585 | 585 | /** |
586 | 586 | * Enqueue scripts for the customizer. |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | |
594 | 594 | wp_enqueue_script( |
595 | 595 | 'twentytwentyone-customize-helpers', |
596 | - get_theme_file_uri( '/assets/js/customize-helpers.js' ), |
|
596 | + get_theme_file_uri('/assets/js/customize-helpers.js'), |
|
597 | 597 | array(), |
598 | - wp_get_theme()->get( 'Version' ), |
|
598 | + wp_get_theme()->get('Version'), |
|
599 | 599 | true |
600 | 600 | ); |
601 | 601 | } |
602 | -add_action( 'customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts' ); |
|
602 | +add_action('customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts'); |
|
603 | 603 | |
604 | 604 | /** |
605 | 605 | * Calculate classes for the main <html> element. |
@@ -616,11 +616,11 @@ discard block |
||
616 | 616 | * |
617 | 617 | * @param string The list of classes. Default empty string. |
618 | 618 | */ |
619 | - $classes = apply_filters( 'twentytwentyone_html_classes', '' ); |
|
620 | - if ( ! $classes ) { |
|
619 | + $classes = apply_filters('twentytwentyone_html_classes', ''); |
|
620 | + if ( ! $classes) { |
|
621 | 621 | return; |
622 | 622 | } |
623 | - echo 'class="' . esc_attr( $classes ) . '"'; |
|
623 | + echo 'class="'.esc_attr($classes).'"'; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -639,9 +639,9 @@ discard block |
||
639 | 639 | </script> |
640 | 640 | <?php |
641 | 641 | } |
642 | -add_action( 'wp_footer', 'twentytwentyone_add_ie_class' ); |
|
642 | +add_action('wp_footer', 'twentytwentyone_add_ie_class'); |
|
643 | 643 | |
644 | -if ( ! function_exists( 'wp_get_list_item_separator' ) ) : |
|
644 | +if ( ! function_exists('wp_get_list_item_separator')) : |
|
645 | 645 | /** |
646 | 646 | * Retrieves the list item separator based on the locale. |
647 | 647 | * |
@@ -651,6 +651,6 @@ discard block |
||
651 | 651 | */ |
652 | 652 | function wp_get_list_item_separator() { |
653 | 653 | /* translators: Used between list items, there is a space after the comma. */ |
654 | - return __( ', ', 'twentytwentyone' ); |
|
654 | + return __(', ', 'twentytwentyone'); |
|
655 | 655 | } |
656 | 656 | endif; |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | </div><!-- #primary --> |
17 | 17 | </div><!-- #content --> |
18 | 18 | |
19 | - <?php get_template_part( 'template-parts/footer/footer-widgets' ); ?> |
|
19 | + <?php get_template_part('template-parts/footer/footer-widgets'); ?> |
|
20 | 20 | |
21 | 21 | <footer id="colophon" class="site-footer"> |
22 | 22 | |
23 | - <?php if ( has_nav_menu( 'footer' ) ) : ?> |
|
24 | - <nav aria-label="<?php esc_attr_e( 'Secondary menu', 'twentytwentyone' ); ?>" class="footer-navigation"> |
|
23 | + <?php if (has_nav_menu('footer')) : ?> |
|
24 | + <nav aria-label="<?php esc_attr_e('Secondary menu', 'twentytwentyone'); ?>" class="footer-navigation"> |
|
25 | 25 | <ul class="footer-navigation-wrapper"> |
26 | 26 | <?php |
27 | 27 | wp_nav_menu( |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | <?php endif; ?> |
42 | 42 | <div class="site-info"> |
43 | 43 | <div class="site-name"> |
44 | - <?php if ( has_custom_logo() ) : ?> |
|
44 | + <?php if (has_custom_logo()) : ?> |
|
45 | 45 | <div class="site-logo"><?php the_custom_logo(); ?></div> |
46 | 46 | <?php else : ?> |
47 | - <?php if ( get_bloginfo( 'name' ) && get_theme_mod( 'display_title_and_tagline', true ) ) : ?> |
|
48 | - <?php if ( is_front_page() && ! is_paged() ) : ?> |
|
49 | - <?php bloginfo( 'name' ); ?> |
|
47 | + <?php if (get_bloginfo('name') && get_theme_mod('display_title_and_tagline', true)) : ?> |
|
48 | + <?php if (is_front_page() && ! is_paged()) : ?> |
|
49 | + <?php bloginfo('name'); ?> |
|
50 | 50 | <?php else : ?> |
51 | - <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a> |
|
51 | + <a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a> |
|
52 | 52 | <?php endif; ?> |
53 | 53 | <?php endif; ?> |
54 | 54 | <?php endif; ?> |
55 | 55 | </div><!-- .site-name --> |
56 | 56 | |
57 | 57 | <?php |
58 | - if ( function_exists( 'the_privacy_policy_link' ) ) { |
|
59 | - the_privacy_policy_link( '<div class="privacy-policy">', '</div>' ); |
|
58 | + if (function_exists('the_privacy_policy_link')) { |
|
59 | + the_privacy_policy_link('<div class="privacy-policy">', '</div>'); |
|
60 | 60 | } |
61 | 61 | ?> |
62 | 62 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | <?php |
65 | 65 | printf( |
66 | 66 | /* translators: %s: WordPress. */ |
67 | - esc_html__( 'Proudly powered by %s.', 'twentytwentyone' ), |
|
68 | - '<a href="' . esc_url( __( 'https://wordpress.org/', 'twentytwentyone' ) ) . '">WordPress</a>' |
|
67 | + esc_html__('Proudly powered by %s.', 'twentytwentyone'), |
|
68 | + '<a href="'.esc_url(__('https://wordpress.org/', 'twentytwentyone')).'">WordPress</a>' |
|
69 | 69 | ); |
70 | 70 | ?> |
71 | 71 | </div><!-- .powered-by --> |
@@ -43,12 +43,18 @@ |
||
43 | 43 | <div class="site-name"> |
44 | 44 | <?php if ( has_custom_logo() ) : ?> |
45 | 45 | <div class="site-logo"><?php the_custom_logo(); ?></div> |
46 | - <?php else : ?> |
|
46 | + <?php else { |
|
47 | + : ?> |
|
47 | 48 | <?php if ( get_bloginfo( 'name' ) && get_theme_mod( 'display_title_and_tagline', true ) ) : ?> |
48 | 49 | <?php if ( is_front_page() && ! is_paged() ) : ?> |
49 | - <?php bloginfo( 'name' ); ?> |
|
50 | - <?php else : ?> |
|
51 | - <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a> |
|
50 | + <?php bloginfo( 'name' ); |
|
51 | +} |
|
52 | +?> |
|
53 | + <?php else { |
|
54 | + : ?> |
|
55 | + <a href="<?php echo esc_url( home_url( '/' ) ); |
|
56 | +} |
|
57 | +?>"><?php bloginfo( 'name' ); ?></a> |
|
52 | 58 | <?php endif; ?> |
53 | 59 | <?php endif; ?> |
54 | 60 | <?php endif; ?> |
@@ -20,23 +20,23 @@ |
||
20 | 20 | * @param bool $display Print the styles. |
21 | 21 | * @return string |
22 | 22 | */ |
23 | -function twenty_twenty_one_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $display = true ) { |
|
23 | +function twenty_twenty_one_generate_css($selector, $style, $value, $prefix = '', $suffix = '', $display = true) { |
|
24 | 24 | |
25 | 25 | // Bail early if there is no $selector elements or properties and $value. |
26 | - if ( ! $value || ! $selector ) { |
|
26 | + if ( ! $value || ! $selector) { |
|
27 | 27 | return ''; |
28 | 28 | } |
29 | 29 | |
30 | - $css = sprintf( '%s { %s: %s; }', $selector, $style, $prefix . $value . $suffix ); |
|
30 | + $css = sprintf('%s { %s: %s; }', $selector, $style, $prefix.$value.$suffix); |
|
31 | 31 | |
32 | - if ( $display ) { |
|
32 | + if ($display) { |
|
33 | 33 | /* |
34 | 34 | * Note to reviewers: $css contains auto-generated CSS. |
35 | 35 | * It is included inside <style> tags and can only be interpreted as CSS on the browser. |
36 | 36 | * Using wp_strip_all_tags() here is sufficient escaping to avoid |
37 | 37 | * malicious attempts to close </style> and open a <script>. |
38 | 38 | */ |
39 | - echo wp_strip_all_tags( $css ); // phpcs:ignore WordPress.Security.EscapeOutput |
|
39 | + echo wp_strip_all_tags($css); // phpcs:ignore WordPress.Security.EscapeOutput |
|
40 | 40 | } |
41 | 41 | return $css; |
42 | 42 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since Twenty Twenty-One 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( function_exists( 'register_block_style' ) ) { |
|
12 | +if (function_exists('register_block_style')) { |
|
13 | 13 | /** |
14 | 14 | * Register block styles. |
15 | 15 | * |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | 'core/columns', |
24 | 24 | array( |
25 | 25 | 'name' => 'twentytwentyone-columns-overlap', |
26 | - 'label' => esc_html__( 'Overlap', 'twentytwentyone' ), |
|
26 | + 'label' => esc_html__('Overlap', 'twentytwentyone'), |
|
27 | 27 | ) |
28 | 28 | ); |
29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'core/cover', |
33 | 33 | array( |
34 | 34 | 'name' => 'twentytwentyone-border', |
35 | - 'label' => esc_html__( 'Borders', 'twentytwentyone' ), |
|
35 | + 'label' => esc_html__('Borders', 'twentytwentyone'), |
|
36 | 36 | ) |
37 | 37 | ); |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'core/group', |
42 | 42 | array( |
43 | 43 | 'name' => 'twentytwentyone-border', |
44 | - 'label' => esc_html__( 'Borders', 'twentytwentyone' ), |
|
44 | + 'label' => esc_html__('Borders', 'twentytwentyone'), |
|
45 | 45 | ) |
46 | 46 | ); |
47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'core/image', |
51 | 51 | array( |
52 | 52 | 'name' => 'twentytwentyone-border', |
53 | - 'label' => esc_html__( 'Borders', 'twentytwentyone' ), |
|
53 | + 'label' => esc_html__('Borders', 'twentytwentyone'), |
|
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'core/image', |
60 | 60 | array( |
61 | 61 | 'name' => 'twentytwentyone-image-frame', |
62 | - 'label' => esc_html__( 'Frame', 'twentytwentyone' ), |
|
62 | + 'label' => esc_html__('Frame', 'twentytwentyone'), |
|
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'core/latest-posts', |
69 | 69 | array( |
70 | 70 | 'name' => 'twentytwentyone-latest-posts-dividers', |
71 | - 'label' => esc_html__( 'Dividers', 'twentytwentyone' ), |
|
71 | + 'label' => esc_html__('Dividers', 'twentytwentyone'), |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | 'core/latest-posts', |
78 | 78 | array( |
79 | 79 | 'name' => 'twentytwentyone-latest-posts-borders', |
80 | - 'label' => esc_html__( 'Borders', 'twentytwentyone' ), |
|
80 | + 'label' => esc_html__('Borders', 'twentytwentyone'), |
|
81 | 81 | ) |
82 | 82 | ); |
83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'core/media-text', |
87 | 87 | array( |
88 | 88 | 'name' => 'twentytwentyone-border', |
89 | - 'label' => esc_html__( 'Borders', 'twentytwentyone' ), |
|
89 | + 'label' => esc_html__('Borders', 'twentytwentyone'), |
|
90 | 90 | ) |
91 | 91 | ); |
92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'core/separator', |
96 | 96 | array( |
97 | 97 | 'name' => 'twentytwentyone-separator-thick', |
98 | - 'label' => esc_html__( 'Thick', 'twentytwentyone' ), |
|
98 | + 'label' => esc_html__('Thick', 'twentytwentyone'), |
|
99 | 99 | ) |
100 | 100 | ); |
101 | 101 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | 'core/social-links', |
105 | 105 | array( |
106 | 106 | 'name' => 'twentytwentyone-social-icons-color', |
107 | - 'label' => esc_html__( 'Dark gray', 'twentytwentyone' ), |
|
107 | + 'label' => esc_html__('Dark gray', 'twentytwentyone'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | } |
111 | - add_action( 'init', 'twenty_twenty_one_register_block_styles' ); |
|
111 | + add_action('init', 'twenty_twenty_one_register_block_styles'); |
|
112 | 112 | } |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | * @param object $args Nav menu args. |
25 | 25 | * @return string Nav menu item start element. |
26 | 26 | */ |
27 | -function twenty_twenty_one_add_sub_menu_toggle( $output, $item, $depth, $args ) { |
|
28 | - if ( 0 === $depth && in_array( 'menu-item-has-children', $item->classes, true ) ) { |
|
27 | +function twenty_twenty_one_add_sub_menu_toggle($output, $item, $depth, $args) { |
|
28 | + if (0 === $depth && in_array('menu-item-has-children', $item->classes, true)) { |
|
29 | 29 | |
30 | 30 | // Add toggle button. |
31 | 31 | $output .= '<button class="sub-menu-toggle" aria-expanded="false" onClick="twentytwentyoneExpandSubMenu(this)">'; |
32 | - $output .= '<span class="icon-plus">' . twenty_twenty_one_get_icon_svg( 'ui', 'plus', 18 ) . '</span>'; |
|
33 | - $output .= '<span class="icon-minus">' . twenty_twenty_one_get_icon_svg( 'ui', 'minus', 18 ) . '</span>'; |
|
34 | - $output .= '<span class="screen-reader-text">' . esc_html__( 'Open menu', 'twentytwentyone' ) . '</span>'; |
|
32 | + $output .= '<span class="icon-plus">'.twenty_twenty_one_get_icon_svg('ui', 'plus', 18).'</span>'; |
|
33 | + $output .= '<span class="icon-minus">'.twenty_twenty_one_get_icon_svg('ui', 'minus', 18).'</span>'; |
|
34 | + $output .= '<span class="screen-reader-text">'.esc_html__('Open menu', 'twentytwentyone').'</span>'; |
|
35 | 35 | $output .= '</button>'; |
36 | 36 | } |
37 | 37 | return $output; |
38 | 38 | } |
39 | -add_filter( 'walker_nav_menu_start_el', 'twenty_twenty_one_add_sub_menu_toggle', 10, 4 ); |
|
39 | +add_filter('walker_nav_menu_start_el', 'twenty_twenty_one_add_sub_menu_toggle', 10, 4); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Detects the social network from a URL and returns the SVG code for its icon. |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param int $size The icon size in pixels. |
48 | 48 | * @return string |
49 | 49 | */ |
50 | -function twenty_twenty_one_get_social_link_svg( $uri, $size = 24 ) { |
|
51 | - return Twenty_Twenty_One_SVG_Icons::get_social_link_svg( $uri, $size ); |
|
50 | +function twenty_twenty_one_get_social_link_svg($uri, $size = 24) { |
|
51 | + return Twenty_Twenty_One_SVG_Icons::get_social_link_svg($uri, $size); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * @param stdClass $args An object of wp_nav_menu() arguments. |
63 | 63 | * @return string The menu item output with social icon. |
64 | 64 | */ |
65 | -function twenty_twenty_one_nav_menu_social_icons( $item_output, $item, $depth, $args ) { |
|
65 | +function twenty_twenty_one_nav_menu_social_icons($item_output, $item, $depth, $args) { |
|
66 | 66 | // Change SVG icon inside social links menu if there is supported URL. |
67 | - if ( 'footer' === $args->theme_location ) { |
|
68 | - $svg = twenty_twenty_one_get_social_link_svg( $item->url, 24 ); |
|
69 | - if ( ! empty( $svg ) ) { |
|
70 | - $item_output = str_replace( $args->link_before, $svg, $item_output ); |
|
67 | + if ('footer' === $args->theme_location) { |
|
68 | + $svg = twenty_twenty_one_get_social_link_svg($item->url, 24); |
|
69 | + if ( ! empty($svg)) { |
|
70 | + $item_output = str_replace($args->link_before, $svg, $item_output); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | return $item_output; |
75 | 75 | } |
76 | 76 | |
77 | -add_filter( 'walker_nav_menu_start_el', 'twenty_twenty_one_nav_menu_social_icons', 10, 4 ); |
|
77 | +add_filter('walker_nav_menu_start_el', 'twenty_twenty_one_nav_menu_social_icons', 10, 4); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Filters the arguments for a single nav menu item. |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | * @param int $depth Depth of menu item. Used for padding. |
87 | 87 | * @return stdClass |
88 | 88 | */ |
89 | -function twenty_twenty_one_add_menu_description_args( $args, $item, $depth ) { |
|
90 | - if ( '</span>' !== $args->link_after ) { |
|
89 | +function twenty_twenty_one_add_menu_description_args($args, $item, $depth) { |
|
90 | + if ('</span>' !== $args->link_after) { |
|
91 | 91 | $args->link_after = ''; |
92 | 92 | } |
93 | 93 | |
94 | - if ( 0 === $depth && isset( $item->description ) && $item->description ) { |
|
94 | + if (0 === $depth && isset($item->description) && $item->description) { |
|
95 | 95 | // The extra <span> element is here for styling purposes: Allows the description to not be underlined on hover. |
96 | - $args->link_after = '<p class="menu-item-description"><span>' . $item->description . '</span></p>'; |
|
96 | + $args->link_after = '<p class="menu-item-description"><span>'.$item->description.'</span></p>'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $args; |
100 | 100 | } |
101 | -add_filter( 'nav_menu_item_args', 'twenty_twenty_one_add_menu_description_args', 10, 3 ); |
|
101 | +add_filter('nav_menu_item_args', 'twenty_twenty_one_add_menu_description_args', 10, 3); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since Twenty Twenty-One 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! function_exists( 'twenty_twenty_one_posted_on' ) ) { |
|
10 | +if ( ! function_exists('twenty_twenty_one_posted_on')) { |
|
11 | 11 | /** |
12 | 12 | * Prints HTML with meta information for the current post-date/time. |
13 | 13 | * |
@@ -20,20 +20,20 @@ discard block |
||
20 | 20 | |
21 | 21 | $time_string = sprintf( |
22 | 22 | $time_string, |
23 | - esc_attr( get_the_date( DATE_W3C ) ), |
|
24 | - esc_html( get_the_date() ) |
|
23 | + esc_attr(get_the_date(DATE_W3C)), |
|
24 | + esc_html(get_the_date()) |
|
25 | 25 | ); |
26 | 26 | echo '<span class="posted-on">'; |
27 | 27 | printf( |
28 | 28 | /* translators: %s: Publish date. */ |
29 | - esc_html__( 'Published %s', 'twentytwentyone' ), |
|
29 | + esc_html__('Published %s', 'twentytwentyone'), |
|
30 | 30 | $time_string // phpcs:ignore WordPress.Security.EscapeOutput |
31 | 31 | ); |
32 | 32 | echo '</span>'; |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -if ( ! function_exists( 'twenty_twenty_one_posted_by' ) ) { |
|
36 | +if ( ! function_exists('twenty_twenty_one_posted_by')) { |
|
37 | 37 | /** |
38 | 38 | * Prints HTML with meta information about theme author. |
39 | 39 | * |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | * @return void |
43 | 43 | */ |
44 | 44 | function twenty_twenty_one_posted_by() { |
45 | - if ( ! get_the_author_meta( 'description' ) && post_type_supports( get_post_type(), 'author' ) ) { |
|
45 | + if ( ! get_the_author_meta('description') && post_type_supports(get_post_type(), 'author')) { |
|
46 | 46 | echo '<span class="byline">'; |
47 | 47 | printf( |
48 | 48 | /* translators: %s: Author name. */ |
49 | - esc_html__( 'By %s', 'twentytwentyone' ), |
|
50 | - '<a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" rel="author">' . esc_html( get_the_author() ) . '</a>' |
|
49 | + esc_html__('By %s', 'twentytwentyone'), |
|
50 | + '<a href="'.esc_url(get_author_posts_url(get_the_author_meta('ID'))).'" rel="author">'.esc_html(get_the_author()).'</a>' |
|
51 | 51 | ); |
52 | 52 | echo '</span>'; |
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -if ( ! function_exists( 'twenty_twenty_one_entry_meta_footer' ) ) { |
|
57 | +if ( ! function_exists('twenty_twenty_one_entry_meta_footer')) { |
|
58 | 58 | /** |
59 | 59 | * Prints HTML with meta information for the categories, tags and comments. |
60 | 60 | * Footer entry meta is displayed differently in archives and single posts. |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | function twenty_twenty_one_entry_meta_footer() { |
67 | 67 | |
68 | 68 | // Early exit if not a post. |
69 | - if ( 'post' !== get_post_type() ) { |
|
69 | + if ('post' !== get_post_type()) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | 73 | // Hide meta information on pages. |
74 | - if ( ! is_single() ) { |
|
74 | + if ( ! is_single()) { |
|
75 | 75 | |
76 | - if ( is_sticky() ) { |
|
77 | - echo '<p>' . esc_html_x( 'Featured post', 'Label for sticky posts', 'twentytwentyone' ) . '</p>'; |
|
76 | + if (is_sticky()) { |
|
77 | + echo '<p>'.esc_html_x('Featured post', 'Label for sticky posts', 'twentytwentyone').'</p>'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $post_format = get_post_format(); |
81 | - if ( 'aside' === $post_format || 'status' === $post_format ) { |
|
82 | - echo '<p><a href="' . esc_url( get_permalink() ) . '">' . twenty_twenty_one_continue_reading_text() . '</a></p>'; // phpcs:ignore WordPress.Security.EscapeOutput |
|
81 | + if ('aside' === $post_format || 'status' === $post_format) { |
|
82 | + echo '<p><a href="'.esc_url(get_permalink()).'">'.twenty_twenty_one_continue_reading_text().'</a></p>'; // phpcs:ignore WordPress.Security.EscapeOutput |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Posted on. |
@@ -89,31 +89,31 @@ discard block |
||
89 | 89 | edit_post_link( |
90 | 90 | sprintf( |
91 | 91 | /* translators: %s: Post title. Only visible to screen readers. */ |
92 | - esc_html__( 'Edit %s', 'twentytwentyone' ), |
|
93 | - '<span class="screen-reader-text">' . get_the_title() . '</span>' |
|
92 | + esc_html__('Edit %s', 'twentytwentyone'), |
|
93 | + '<span class="screen-reader-text">'.get_the_title().'</span>' |
|
94 | 94 | ), |
95 | 95 | '<span class="edit-link">', |
96 | 96 | '</span><br>' |
97 | 97 | ); |
98 | 98 | |
99 | - if ( has_category() || has_tag() ) { |
|
99 | + if (has_category() || has_tag()) { |
|
100 | 100 | |
101 | 101 | echo '<div class="post-taxonomies">'; |
102 | 102 | |
103 | - $categories_list = get_the_category_list( wp_get_list_item_separator() ); |
|
104 | - if ( $categories_list ) { |
|
103 | + $categories_list = get_the_category_list(wp_get_list_item_separator()); |
|
104 | + if ($categories_list) { |
|
105 | 105 | printf( |
106 | 106 | /* translators: %s: List of categories. */ |
107 | - '<span class="cat-links">' . esc_html__( 'Categorized as %s', 'twentytwentyone' ) . ' </span>', |
|
107 | + '<span class="cat-links">'.esc_html__('Categorized as %s', 'twentytwentyone').' </span>', |
|
108 | 108 | $categories_list // phpcs:ignore WordPress.Security.EscapeOutput |
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
112 | - $tags_list = get_the_tag_list( '', wp_get_list_item_separator() ); |
|
113 | - if ( $tags_list ) { |
|
112 | + $tags_list = get_the_tag_list('', wp_get_list_item_separator()); |
|
113 | + if ($tags_list) { |
|
114 | 114 | printf( |
115 | 115 | /* translators: %s: List of tags. */ |
116 | - '<span class="tags-links">' . esc_html__( 'Tagged %s', 'twentytwentyone' ) . '</span>', |
|
116 | + '<span class="tags-links">'.esc_html__('Tagged %s', 'twentytwentyone').'</span>', |
|
117 | 117 | $tags_list // phpcs:ignore WordPress.Security.EscapeOutput |
118 | 118 | ); |
119 | 119 | } |
@@ -130,32 +130,32 @@ discard block |
||
130 | 130 | edit_post_link( |
131 | 131 | sprintf( |
132 | 132 | /* translators: %s: Post title. Only visible to screen readers. */ |
133 | - esc_html__( 'Edit %s', 'twentytwentyone' ), |
|
134 | - '<span class="screen-reader-text">' . get_the_title() . '</span>' |
|
133 | + esc_html__('Edit %s', 'twentytwentyone'), |
|
134 | + '<span class="screen-reader-text">'.get_the_title().'</span>' |
|
135 | 135 | ), |
136 | 136 | '<span class="edit-link">', |
137 | 137 | '</span>' |
138 | 138 | ); |
139 | 139 | echo '</div>'; |
140 | 140 | |
141 | - if ( has_category() || has_tag() ) { |
|
141 | + if (has_category() || has_tag()) { |
|
142 | 142 | |
143 | 143 | echo '<div class="post-taxonomies">'; |
144 | 144 | |
145 | - $categories_list = get_the_category_list( wp_get_list_item_separator() ); |
|
146 | - if ( $categories_list ) { |
|
145 | + $categories_list = get_the_category_list(wp_get_list_item_separator()); |
|
146 | + if ($categories_list) { |
|
147 | 147 | printf( |
148 | 148 | /* translators: %s: List of categories. */ |
149 | - '<span class="cat-links">' . esc_html__( 'Categorized as %s', 'twentytwentyone' ) . ' </span>', |
|
149 | + '<span class="cat-links">'.esc_html__('Categorized as %s', 'twentytwentyone').' </span>', |
|
150 | 150 | $categories_list // phpcs:ignore WordPress.Security.EscapeOutput |
151 | 151 | ); |
152 | 152 | } |
153 | 153 | |
154 | - $tags_list = get_the_tag_list( '', wp_get_list_item_separator() ); |
|
155 | - if ( $tags_list ) { |
|
154 | + $tags_list = get_the_tag_list('', wp_get_list_item_separator()); |
|
155 | + if ($tags_list) { |
|
156 | 156 | printf( |
157 | 157 | /* translators: %s: List of tags. */ |
158 | - '<span class="tags-links">' . esc_html__( 'Tagged %s', 'twentytwentyone' ) . '</span>', |
|
158 | + '<span class="tags-links">'.esc_html__('Tagged %s', 'twentytwentyone').'</span>', |
|
159 | 159 | $tags_list // phpcs:ignore WordPress.Security.EscapeOutput |
160 | 160 | ); |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | -if ( ! function_exists( 'twenty_twenty_one_post_thumbnail' ) ) { |
|
168 | +if ( ! function_exists('twenty_twenty_one_post_thumbnail')) { |
|
169 | 169 | /** |
170 | 170 | * Displays an optional post thumbnail. |
171 | 171 | * |
@@ -177,20 +177,20 @@ discard block |
||
177 | 177 | * @return void |
178 | 178 | */ |
179 | 179 | function twenty_twenty_one_post_thumbnail() { |
180 | - if ( ! twenty_twenty_one_can_show_post_thumbnail() ) { |
|
180 | + if ( ! twenty_twenty_one_can_show_post_thumbnail()) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | ?> |
184 | 184 | |
185 | - <?php if ( is_singular() ) : ?> |
|
185 | + <?php if (is_singular()) : ?> |
|
186 | 186 | |
187 | 187 | <figure class="post-thumbnail"> |
188 | 188 | <?php |
189 | 189 | // Lazy-loading attributes should be skipped for thumbnails since they are immediately in the viewport. |
190 | - the_post_thumbnail( 'post-thumbnail', array( 'loading' => false ) ); |
|
190 | + the_post_thumbnail('post-thumbnail', array('loading' => false)); |
|
191 | 191 | ?> |
192 | - <?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?> |
|
193 | - <figcaption class="wp-caption-text"><?php echo wp_kses_post( wp_get_attachment_caption( get_post_thumbnail_id() ) ); ?></figcaption> |
|
192 | + <?php if (wp_get_attachment_caption(get_post_thumbnail_id())) : ?> |
|
193 | + <figcaption class="wp-caption-text"><?php echo wp_kses_post(wp_get_attachment_caption(get_post_thumbnail_id())); ?></figcaption> |
|
194 | 194 | <?php endif; ?> |
195 | 195 | </figure><!-- .post-thumbnail --> |
196 | 196 | |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | |
199 | 199 | <figure class="post-thumbnail"> |
200 | 200 | <a class="post-thumbnail-inner alignwide" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1"> |
201 | - <?php the_post_thumbnail( 'post-thumbnail' ); ?> |
|
201 | + <?php the_post_thumbnail('post-thumbnail'); ?> |
|
202 | 202 | </a> |
203 | - <?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?> |
|
204 | - <figcaption class="wp-caption-text"><?php echo wp_kses_post( wp_get_attachment_caption( get_post_thumbnail_id() ) ); ?></figcaption> |
|
203 | + <?php if (wp_get_attachment_caption(get_post_thumbnail_id())) : ?> |
|
204 | + <figcaption class="wp-caption-text"><?php echo wp_kses_post(wp_get_attachment_caption(get_post_thumbnail_id())); ?></figcaption> |
|
205 | 205 | <?php endif; ?> |
206 | 206 | </figure> |
207 | 207 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | -if ( ! function_exists( 'twenty_twenty_one_the_posts_navigation' ) ) { |
|
213 | +if ( ! function_exists('twenty_twenty_one_the_posts_navigation')) { |
|
214 | 214 | /** |
215 | 215 | * Print the next and previous posts navigation. |
216 | 216 | * |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | function twenty_twenty_one_the_posts_navigation() { |
222 | 222 | the_posts_pagination( |
223 | 223 | array( |
224 | - 'before_page_number' => esc_html__( 'Page', 'twentytwentyone' ) . ' ', |
|
224 | + 'before_page_number' => esc_html__('Page', 'twentytwentyone').' ', |
|
225 | 225 | 'mid_size' => 0, |
226 | 226 | 'prev_text' => sprintf( |
227 | 227 | '%s <span class="nav-prev-text">%s</span>', |
228 | - is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ), |
|
228 | + is_rtl() ? twenty_twenty_one_get_icon_svg('ui', 'arrow_right') : twenty_twenty_one_get_icon_svg('ui', 'arrow_left'), |
|
229 | 229 | wp_kses( |
230 | - __( 'Newer <span class="nav-short">posts</span>', 'twentytwentyone' ), |
|
230 | + __('Newer <span class="nav-short">posts</span>', 'twentytwentyone'), |
|
231 | 231 | array( |
232 | 232 | 'span' => array( |
233 | 233 | 'class' => array(), |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | 'next_text' => sprintf( |
239 | 239 | '<span class="nav-next-text">%s</span> %s', |
240 | 240 | wp_kses( |
241 | - __( 'Older <span class="nav-short">posts</span>', 'twentytwentyone' ), |
|
241 | + __('Older <span class="nav-short">posts</span>', 'twentytwentyone'), |
|
242 | 242 | array( |
243 | 243 | 'span' => array( |
244 | 244 | 'class' => array(), |
245 | 245 | ), |
246 | 246 | ) |
247 | 247 | ), |
248 | - is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) |
|
248 | + is_rtl() ? twenty_twenty_one_get_icon_svg('ui', 'arrow_left') : twenty_twenty_one_get_icon_svg('ui', 'arrow_right') |
|
249 | 249 | ), |
250 | 250 | ) |
251 | 251 | ); |
@@ -194,10 +194,13 @@ |
||
194 | 194 | <?php endif; ?> |
195 | 195 | </figure><!-- .post-thumbnail --> |
196 | 196 | |
197 | - <?php else : ?> |
|
197 | + <?php else { |
|
198 | + : ?> |
|
198 | 199 | |
199 | 200 | <figure class="post-thumbnail"> |
200 | - <a class="post-thumbnail-inner alignwide" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1"> |
|
201 | + <a class="post-thumbnail-inner alignwide" href="<?php the_permalink(); |
|
202 | +} |
|
203 | +?>" aria-hidden="true" tabindex="-1"> |
|
201 | 204 | <?php the_post_thumbnail( 'post-thumbnail' ); ?> |
202 | 205 | </a> |
203 | 206 | <?php if ( wp_get_attachment_caption( get_post_thumbnail_id() ) ) : ?> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @param array $classes Classes for the body element. |
16 | 16 | * @return array |
17 | 17 | */ |
18 | -function twenty_twenty_one_body_classes( $classes ) { |
|
18 | +function twenty_twenty_one_body_classes($classes) { |
|
19 | 19 | |
20 | 20 | // Helps detect if JS is enabled or not. |
21 | 21 | $classes[] = 'no-js'; |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | $classes[] = is_singular() ? 'singular' : 'hfeed'; |
25 | 25 | |
26 | 26 | // Add a body class if main navigation is active. |
27 | - if ( has_nav_menu( 'primary' ) ) { |
|
27 | + if (has_nav_menu('primary')) { |
|
28 | 28 | $classes[] = 'has-main-navigation'; |
29 | 29 | } |
30 | 30 | |
31 | 31 | // Add a body class if there are no footer widgets. |
32 | - if ( ! is_active_sidebar( 'sidebar-1' ) ) { |
|
32 | + if ( ! is_active_sidebar('sidebar-1')) { |
|
33 | 33 | $classes[] = 'no-widgets'; |
34 | 34 | } |
35 | 35 | |
36 | 36 | return $classes; |
37 | 37 | } |
38 | -add_filter( 'body_class', 'twenty_twenty_one_body_classes' ); |
|
38 | +add_filter('body_class', 'twenty_twenty_one_body_classes'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Adds custom class to the array of posts classes. |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * @param array $classes An array of CSS classes. |
46 | 46 | * @return array |
47 | 47 | */ |
48 | -function twenty_twenty_one_post_classes( $classes ) { |
|
48 | +function twenty_twenty_one_post_classes($classes) { |
|
49 | 49 | $classes[] = 'entry'; |
50 | 50 | |
51 | 51 | return $classes; |
52 | 52 | } |
53 | -add_filter( 'post_class', 'twenty_twenty_one_post_classes', 10, 3 ); |
|
53 | +add_filter('post_class', 'twenty_twenty_one_post_classes', 10, 3); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Add a pingback url auto-discovery header for single posts, pages, or attachments. |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | * @return void |
61 | 61 | */ |
62 | 62 | function twenty_twenty_one_pingback_header() { |
63 | - if ( is_singular() && pings_open() ) { |
|
64 | - echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">'; |
|
63 | + if (is_singular() && pings_open()) { |
|
64 | + echo '<link rel="pingback" href="', esc_url(get_bloginfo('pingback_url')), '">'; |
|
65 | 65 | } |
66 | 66 | } |
67 | -add_action( 'wp_head', 'twenty_twenty_one_pingback_header' ); |
|
67 | +add_action('wp_head', 'twenty_twenty_one_pingback_header'); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Remove the `no-js` class from body if JS is supported. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | function twenty_twenty_one_supports_js() { |
77 | 77 | echo '<script>document.body.classList.remove("no-js");</script>'; |
78 | 78 | } |
79 | -add_action( 'wp_footer', 'twenty_twenty_one_supports_js' ); |
|
79 | +add_action('wp_footer', 'twenty_twenty_one_supports_js'); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Changes comment form default fields. |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * @param array $defaults The form defaults. |
87 | 87 | * @return array |
88 | 88 | */ |
89 | -function twenty_twenty_one_comment_form_defaults( $defaults ) { |
|
89 | +function twenty_twenty_one_comment_form_defaults($defaults) { |
|
90 | 90 | |
91 | 91 | // Adjust height of comment form. |
92 | - $defaults['comment_field'] = preg_replace( '/rows="\d+"/', 'rows="5"', $defaults['comment_field'] ); |
|
92 | + $defaults['comment_field'] = preg_replace('/rows="\d+"/', 'rows="5"', $defaults['comment_field']); |
|
93 | 93 | |
94 | 94 | return $defaults; |
95 | 95 | } |
96 | -add_filter( 'comment_form_defaults', 'twenty_twenty_one_comment_form_defaults' ); |
|
96 | +add_filter('comment_form_defaults', 'twenty_twenty_one_comment_form_defaults'); |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Determines if post thumbnail can be displayed. |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | function twenty_twenty_one_continue_reading_text() { |
136 | 136 | $continue_reading = sprintf( |
137 | 137 | /* translators: %s: Post title. Only visible to screen readers. */ |
138 | - esc_html__( 'Continue reading %s', 'twentytwentyone' ), |
|
139 | - the_title( '<span class="screen-reader-text">', '</span>', false ) |
|
138 | + esc_html__('Continue reading %s', 'twentytwentyone'), |
|
139 | + the_title('<span class="screen-reader-text">', '</span>', false) |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | return $continue_reading; |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | * @since Twenty Twenty-One 1.0 |
149 | 149 | */ |
150 | 150 | function twenty_twenty_one_continue_reading_link_excerpt() { |
151 | - if ( ! is_admin() ) { |
|
152 | - return '… <a class="more-link" href="' . esc_url( get_permalink() ) . '">' . twenty_twenty_one_continue_reading_text() . '</a>'; |
|
151 | + if ( ! is_admin()) { |
|
152 | + return '… <a class="more-link" href="'.esc_url(get_permalink()).'">'.twenty_twenty_one_continue_reading_text().'</a>'; |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | // Filter the excerpt more link. |
157 | -add_filter( 'excerpt_more', 'twenty_twenty_one_continue_reading_link_excerpt' ); |
|
157 | +add_filter('excerpt_more', 'twenty_twenty_one_continue_reading_link_excerpt'); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Creates the continue reading link. |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | * @since Twenty Twenty-One 1.0 |
163 | 163 | */ |
164 | 164 | function twenty_twenty_one_continue_reading_link() { |
165 | - if ( ! is_admin() ) { |
|
166 | - return '<div class="more-link-container"><a class="more-link" href="' . esc_url( get_permalink() ) . '#more-' . esc_attr( get_the_ID() ) . '">' . twenty_twenty_one_continue_reading_text() . '</a></div>'; |
|
165 | + if ( ! is_admin()) { |
|
166 | + return '<div class="more-link-container"><a class="more-link" href="'.esc_url(get_permalink()).'#more-'.esc_attr(get_the_ID()).'">'.twenty_twenty_one_continue_reading_text().'</a></div>'; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | // Filter the content more link. |
171 | -add_filter( 'the_content_more_link', 'twenty_twenty_one_continue_reading_link' ); |
|
171 | +add_filter('the_content_more_link', 'twenty_twenty_one_continue_reading_link'); |
|
172 | 172 | |
173 | -if ( ! function_exists( 'twenty_twenty_one_post_title' ) ) { |
|
173 | +if ( ! function_exists('twenty_twenty_one_post_title')) { |
|
174 | 174 | /** |
175 | 175 | * Adds a title to posts and pages that are missing titles. |
176 | 176 | * |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | * @param string $title The title. |
180 | 180 | * @return string |
181 | 181 | */ |
182 | - function twenty_twenty_one_post_title( $title ) { |
|
183 | - return '' === $title ? esc_html_x( 'Untitled', 'Added to posts and pages that are missing titles', 'twentytwentyone' ) : $title; |
|
182 | + function twenty_twenty_one_post_title($title) { |
|
183 | + return '' === $title ? esc_html_x('Untitled', 'Added to posts and pages that are missing titles', 'twentytwentyone') : $title; |
|
184 | 184 | } |
185 | 185 | } |
186 | -add_filter( 'the_title', 'twenty_twenty_one_post_title' ); |
|
186 | +add_filter('the_title', 'twenty_twenty_one_post_title'); |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * Gets the SVG code for a given icon. |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param int $size The icon size in pixels. |
196 | 196 | * @return string |
197 | 197 | */ |
198 | -function twenty_twenty_one_get_icon_svg( $group, $icon, $size = 24 ) { |
|
199 | - return Twenty_Twenty_One_SVG_Icons::get_svg( $group, $icon, $size ); |
|
198 | +function twenty_twenty_one_get_icon_svg($group, $icon, $size = 24) { |
|
199 | + return Twenty_Twenty_One_SVG_Icons::get_svg($group, $icon, $size); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | * @param string $calendar_output The generated HTML of the calendar. |
208 | 208 | * @return string |
209 | 209 | */ |
210 | -function twenty_twenty_one_change_calendar_nav_arrows( $calendar_output ) { |
|
211 | - $calendar_output = str_replace( '« ', is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ), $calendar_output ); |
|
212 | - $calendar_output = str_replace( ' »', is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ), $calendar_output ); |
|
210 | +function twenty_twenty_one_change_calendar_nav_arrows($calendar_output) { |
|
211 | + $calendar_output = str_replace('« ', is_rtl() ? twenty_twenty_one_get_icon_svg('ui', 'arrow_right') : twenty_twenty_one_get_icon_svg('ui', 'arrow_left'), $calendar_output); |
|
212 | + $calendar_output = str_replace(' »', is_rtl() ? twenty_twenty_one_get_icon_svg('ui', 'arrow_left') : twenty_twenty_one_get_icon_svg('ui', 'arrow_right'), $calendar_output); |
|
213 | 213 | return $calendar_output; |
214 | 214 | } |
215 | -add_filter( 'get_calendar', 'twenty_twenty_one_change_calendar_nav_arrows' ); |
|
215 | +add_filter('get_calendar', 'twenty_twenty_one_change_calendar_nav_arrows'); |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Get custom CSS. |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | * @param string $type Whether to return CSS for the "front-end", "block-editor", or "classic-editor". |
225 | 225 | * @return string |
226 | 226 | */ |
227 | -function twenty_twenty_one_get_non_latin_css( $type = 'front-end' ) { |
|
227 | +function twenty_twenty_one_get_non_latin_css($type = 'front-end') { |
|
228 | 228 | |
229 | 229 | // Fetch site locale. |
230 | - $locale = get_bloginfo( 'language' ); |
|
230 | + $locale = get_bloginfo('language'); |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Filters the fallback fonts for non-latin languages. |
@@ -241,67 +241,67 @@ discard block |
||
241 | 241 | array( |
242 | 242 | |
243 | 243 | // Arabic. |
244 | - 'ar' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
245 | - 'ary' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
246 | - 'azb' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
247 | - 'ckb' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
248 | - 'fa-IR' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
249 | - 'haz' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
250 | - 'ps' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
244 | + 'ar' => array('Tahoma', 'Arial', 'sans-serif'), |
|
245 | + 'ary' => array('Tahoma', 'Arial', 'sans-serif'), |
|
246 | + 'azb' => array('Tahoma', 'Arial', 'sans-serif'), |
|
247 | + 'ckb' => array('Tahoma', 'Arial', 'sans-serif'), |
|
248 | + 'fa-IR' => array('Tahoma', 'Arial', 'sans-serif'), |
|
249 | + 'haz' => array('Tahoma', 'Arial', 'sans-serif'), |
|
250 | + 'ps' => array('Tahoma', 'Arial', 'sans-serif'), |
|
251 | 251 | |
252 | 252 | // Chinese Simplified (China) - Noto Sans SC. |
253 | - 'zh-CN' => array( '\'PingFang SC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), |
|
253 | + 'zh-CN' => array('\'PingFang SC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif'), |
|
254 | 254 | |
255 | 255 | // Chinese Traditional (Taiwan) - Noto Sans TC. |
256 | - 'zh-TW' => array( '\'PingFang TC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), |
|
256 | + 'zh-TW' => array('\'PingFang TC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif'), |
|
257 | 257 | |
258 | 258 | // Chinese (Hong Kong) - Noto Sans HK. |
259 | - 'zh-HK' => array( '\'PingFang HK\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), |
|
259 | + 'zh-HK' => array('\'PingFang HK\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif'), |
|
260 | 260 | |
261 | 261 | // Cyrillic. |
262 | - 'bel' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
263 | - 'bg-BG' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
264 | - 'kk' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
265 | - 'mk-MK' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
266 | - 'mn' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
267 | - 'ru-RU' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
268 | - 'sah' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
269 | - 'sr-RS' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
270 | - 'tt-RU' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
271 | - 'uk' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
262 | + 'bel' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
263 | + 'bg-BG' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
264 | + 'kk' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
265 | + 'mk-MK' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
266 | + 'mn' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
267 | + 'ru-RU' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
268 | + 'sah' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
269 | + 'sr-RS' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
270 | + 'tt-RU' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
271 | + 'uk' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
272 | 272 | |
273 | 273 | // Devanagari. |
274 | - 'bn-BD' => array( 'Arial', 'sans-serif' ), |
|
275 | - 'hi-IN' => array( 'Arial', 'sans-serif' ), |
|
276 | - 'mr' => array( 'Arial', 'sans-serif' ), |
|
277 | - 'ne-NP' => array( 'Arial', 'sans-serif' ), |
|
274 | + 'bn-BD' => array('Arial', 'sans-serif'), |
|
275 | + 'hi-IN' => array('Arial', 'sans-serif'), |
|
276 | + 'mr' => array('Arial', 'sans-serif'), |
|
277 | + 'ne-NP' => array('Arial', 'sans-serif'), |
|
278 | 278 | |
279 | 279 | // Greek. |
280 | - 'el' => array( '\'Helvetica Neue\', Helvetica, Arial, sans-serif' ), |
|
280 | + 'el' => array('\'Helvetica Neue\', Helvetica, Arial, sans-serif'), |
|
281 | 281 | |
282 | 282 | // Gujarati. |
283 | - 'gu' => array( 'Arial', 'sans-serif' ), |
|
283 | + 'gu' => array('Arial', 'sans-serif'), |
|
284 | 284 | |
285 | 285 | // Hebrew. |
286 | - 'he-IL' => array( '\'Arial Hebrew\'', 'Arial', 'sans-serif' ), |
|
286 | + 'he-IL' => array('\'Arial Hebrew\'', 'Arial', 'sans-serif'), |
|
287 | 287 | |
288 | 288 | // Japanese. |
289 | - 'ja' => array( 'sans-serif' ), |
|
289 | + 'ja' => array('sans-serif'), |
|
290 | 290 | |
291 | 291 | // Korean. |
292 | - 'ko-KR' => array( '\'Apple SD Gothic Neo\'', '\'Malgun Gothic\'', '\'Nanum Gothic\'', 'Dotum', 'sans-serif' ), |
|
292 | + 'ko-KR' => array('\'Apple SD Gothic Neo\'', '\'Malgun Gothic\'', '\'Nanum Gothic\'', 'Dotum', 'sans-serif'), |
|
293 | 293 | |
294 | 294 | // Thai. |
295 | - 'th' => array( '\'Sukhumvit Set\'', '\'Helvetica Neue\'', 'Helvetica', 'Arial', 'sans-serif' ), |
|
295 | + 'th' => array('\'Sukhumvit Set\'', '\'Helvetica Neue\'', 'Helvetica', 'Arial', 'sans-serif'), |
|
296 | 296 | |
297 | 297 | // Vietnamese. |
298 | - 'vi' => array( '\'Libre Franklin\'', 'sans-serif' ), |
|
298 | + 'vi' => array('\'Libre Franklin\'', 'sans-serif'), |
|
299 | 299 | |
300 | 300 | ) |
301 | 301 | ); |
302 | 302 | |
303 | 303 | // Return if the selected language has no fallback fonts. |
304 | - if ( empty( $font_family[ $locale ] ) ) { |
|
304 | + if (empty($font_family[$locale])) { |
|
305 | 305 | return ''; |
306 | 306 | } |
307 | 307 | |
@@ -315,27 +315,27 @@ discard block |
||
315 | 315 | $elements = apply_filters( |
316 | 316 | 'twenty_twenty_one_get_localized_font_family_elements', |
317 | 317 | array( |
318 | - 'front-end' => array( 'body', 'input', 'textarea', 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', '.has-drop-cap:not(:focus)::first-letter', '.entry-content .wp-block-archives', '.entry-content .wp-block-categories', '.entry-content .wp-block-cover-image', '.entry-content .wp-block-latest-comments', '.entry-content .wp-block-latest-posts', '.entry-content .wp-block-pullquote', '.entry-content .wp-block-quote.is-large', '.entry-content .wp-block-quote.is-style-large', '.entry-content .wp-block-archives *', '.entry-content .wp-block-categories *', '.entry-content .wp-block-latest-posts *', '.entry-content .wp-block-latest-comments *', '.entry-content p', '.entry-content ol', '.entry-content ul', '.entry-content dl', '.entry-content dt', '.entry-content cite', '.entry-content figcaption', '.entry-content .wp-caption-text', '.comment-content p', '.comment-content ol', '.comment-content ul', '.comment-content dl', '.comment-content dt', '.comment-content cite', '.comment-content figcaption', '.comment-content .wp-caption-text', '.widget_text p', '.widget_text ol', '.widget_text ul', '.widget_text dl', '.widget_text dt', '.widget-content .rssSummary', '.widget-content cite', '.widget-content figcaption', '.widget-content .wp-caption-text' ), |
|
319 | - 'block-editor' => array( '.editor-styles-wrapper > *', '.editor-styles-wrapper p', '.editor-styles-wrapper ol', '.editor-styles-wrapper ul', '.editor-styles-wrapper dl', '.editor-styles-wrapper dt', '.editor-post-title__block .editor-post-title__input', '.editor-styles-wrapper .wp-block h1', '.editor-styles-wrapper .wp-block h2', '.editor-styles-wrapper .wp-block h3', '.editor-styles-wrapper .wp-block h4', '.editor-styles-wrapper .wp-block h5', '.editor-styles-wrapper .wp-block h6', '.editor-styles-wrapper .has-drop-cap:not(:focus)::first-letter', '.editor-styles-wrapper cite', '.editor-styles-wrapper figcaption', '.editor-styles-wrapper .wp-caption-text' ), |
|
320 | - 'classic-editor' => array( 'body#tinymce.wp-editor', 'body#tinymce.wp-editor p', 'body#tinymce.wp-editor ol', 'body#tinymce.wp-editor ul', 'body#tinymce.wp-editor dl', 'body#tinymce.wp-editor dt', 'body#tinymce.wp-editor figcaption', 'body#tinymce.wp-editor .wp-caption-text', 'body#tinymce.wp-editor .wp-caption-dd', 'body#tinymce.wp-editor cite', 'body#tinymce.wp-editor table' ), |
|
318 | + 'front-end' => array('body', 'input', 'textarea', 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', '.has-drop-cap:not(:focus)::first-letter', '.entry-content .wp-block-archives', '.entry-content .wp-block-categories', '.entry-content .wp-block-cover-image', '.entry-content .wp-block-latest-comments', '.entry-content .wp-block-latest-posts', '.entry-content .wp-block-pullquote', '.entry-content .wp-block-quote.is-large', '.entry-content .wp-block-quote.is-style-large', '.entry-content .wp-block-archives *', '.entry-content .wp-block-categories *', '.entry-content .wp-block-latest-posts *', '.entry-content .wp-block-latest-comments *', '.entry-content p', '.entry-content ol', '.entry-content ul', '.entry-content dl', '.entry-content dt', '.entry-content cite', '.entry-content figcaption', '.entry-content .wp-caption-text', '.comment-content p', '.comment-content ol', '.comment-content ul', '.comment-content dl', '.comment-content dt', '.comment-content cite', '.comment-content figcaption', '.comment-content .wp-caption-text', '.widget_text p', '.widget_text ol', '.widget_text ul', '.widget_text dl', '.widget_text dt', '.widget-content .rssSummary', '.widget-content cite', '.widget-content figcaption', '.widget-content .wp-caption-text'), |
|
319 | + 'block-editor' => array('.editor-styles-wrapper > *', '.editor-styles-wrapper p', '.editor-styles-wrapper ol', '.editor-styles-wrapper ul', '.editor-styles-wrapper dl', '.editor-styles-wrapper dt', '.editor-post-title__block .editor-post-title__input', '.editor-styles-wrapper .wp-block h1', '.editor-styles-wrapper .wp-block h2', '.editor-styles-wrapper .wp-block h3', '.editor-styles-wrapper .wp-block h4', '.editor-styles-wrapper .wp-block h5', '.editor-styles-wrapper .wp-block h6', '.editor-styles-wrapper .has-drop-cap:not(:focus)::first-letter', '.editor-styles-wrapper cite', '.editor-styles-wrapper figcaption', '.editor-styles-wrapper .wp-caption-text'), |
|
320 | + 'classic-editor' => array('body#tinymce.wp-editor', 'body#tinymce.wp-editor p', 'body#tinymce.wp-editor ol', 'body#tinymce.wp-editor ul', 'body#tinymce.wp-editor dl', 'body#tinymce.wp-editor dt', 'body#tinymce.wp-editor figcaption', 'body#tinymce.wp-editor .wp-caption-text', 'body#tinymce.wp-editor .wp-caption-dd', 'body#tinymce.wp-editor cite', 'body#tinymce.wp-editor table'), |
|
321 | 321 | ) |
322 | 322 | ); |
323 | 323 | |
324 | 324 | // Return if the specified type doesn't exist. |
325 | - if ( empty( $elements[ $type ] ) ) { |
|
325 | + if (empty($elements[$type])) { |
|
326 | 326 | return ''; |
327 | 327 | } |
328 | 328 | |
329 | 329 | // Include file if function doesn't exist. |
330 | - if ( ! function_exists( 'twenty_twenty_one_generate_css' ) ) { |
|
331 | - require_once get_theme_file_path( 'inc/custom-css.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound |
|
330 | + if ( ! function_exists('twenty_twenty_one_generate_css')) { |
|
331 | + require_once get_theme_file_path('inc/custom-css.php'); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | // Return the specified styles. |
335 | 335 | return twenty_twenty_one_generate_css( // @phpstan-ignore-line. |
336 | - implode( ',', $elements[ $type ] ), |
|
336 | + implode(',', $elements[$type]), |
|
337 | 337 | 'font-family', |
338 | - implode( ',', $font_family[ $locale ] ), |
|
338 | + implode(',', $font_family[$locale]), |
|
339 | 339 | null, |
340 | 340 | null, |
341 | 341 | false |
@@ -353,22 +353,22 @@ discard block |
||
353 | 353 | * @param int $instances How many instances of the block will be printed (max). Default 1. |
354 | 354 | * @return bool Returns true if a block was located & printed, otherwise false. |
355 | 355 | */ |
356 | -function twenty_twenty_one_print_first_instance_of_block( $block_name, $content = null, $instances = 1 ) { |
|
356 | +function twenty_twenty_one_print_first_instance_of_block($block_name, $content = null, $instances = 1) { |
|
357 | 357 | $instances_count = 0; |
358 | 358 | $blocks_content = ''; |
359 | 359 | |
360 | - if ( ! $content ) { |
|
360 | + if ( ! $content) { |
|
361 | 361 | $content = get_the_content(); |
362 | 362 | } |
363 | 363 | |
364 | 364 | // Parse blocks in the content. |
365 | - $blocks = parse_blocks( $content ); |
|
365 | + $blocks = parse_blocks($content); |
|
366 | 366 | |
367 | 367 | // Loop blocks. |
368 | - foreach ( $blocks as $block ) { |
|
368 | + foreach ($blocks as $block) { |
|
369 | 369 | |
370 | 370 | // Sanity check. |
371 | - if ( ! isset( $block['blockName'] ) ) { |
|
371 | + if ( ! isset($block['blockName'])) { |
|
372 | 372 | continue; |
373 | 373 | } |
374 | 374 | |
@@ -376,29 +376,29 @@ discard block |
||
376 | 376 | $is_matching_block = false; |
377 | 377 | |
378 | 378 | // If the block ends with *, try to match the first portion. |
379 | - if ( '*' === $block_name[-1] ) { |
|
380 | - $is_matching_block = 0 === strpos( $block['blockName'], rtrim( $block_name, '*' ) ); |
|
379 | + if ('*' === $block_name[-1]) { |
|
380 | + $is_matching_block = 0 === strpos($block['blockName'], rtrim($block_name, '*')); |
|
381 | 381 | } else { |
382 | 382 | $is_matching_block = $block_name === $block['blockName']; |
383 | 383 | } |
384 | 384 | |
385 | - if ( $is_matching_block ) { |
|
385 | + if ($is_matching_block) { |
|
386 | 386 | // Increment count. |
387 | 387 | $instances_count++; |
388 | 388 | |
389 | 389 | // Add the block HTML. |
390 | - $blocks_content .= render_block( $block ); |
|
390 | + $blocks_content .= render_block($block); |
|
391 | 391 | |
392 | 392 | // Break the loop if the $instances count was reached. |
393 | - if ( $instances_count >= $instances ) { |
|
393 | + if ($instances_count >= $instances) { |
|
394 | 394 | break; |
395 | 395 | } |
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | - if ( $blocks_content ) { |
|
399 | + if ($blocks_content) { |
|
400 | 400 | /** This filter is documented in wp-includes/post-template.php */ |
401 | - echo apply_filters( 'the_content', $blocks_content ); // phpcs:ignore WordPress.Security.EscapeOutput |
|
401 | + echo apply_filters('the_content', $blocks_content); // phpcs:ignore WordPress.Security.EscapeOutput |
|
402 | 402 | return true; |
403 | 403 | } |
404 | 404 | |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. |
417 | 417 | * @return string HTML content for password form for password protected post. |
418 | 418 | */ |
419 | -function twenty_twenty_one_password_form( $output, $post = 0 ) { |
|
420 | - $post = get_post( $post ); |
|
421 | - $label = 'pwbox-' . ( empty( $post->ID ) ? wp_rand() : $post->ID ); |
|
422 | - $output = '<p class="post-password-message">' . esc_html__( 'This content is password protected. Please enter a password to view.', 'twentytwentyone' ) . '</p> |
|
423 | - <form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post"> |
|
424 | - <label class="post-password-form__label" for="' . esc_attr( $label ) . '">' . esc_html_x( 'Password', 'Post password form', 'twentytwentyone' ) . '</label><input class="post-password-form__input" name="post_password" id="' . esc_attr( $label ) . '" type="password" size="20" /><input type="submit" class="post-password-form__submit" name="' . esc_attr_x( 'Submit', 'Post password form', 'twentytwentyone' ) . '" value="' . esc_attr_x( 'Enter', 'Post password form', 'twentytwentyone' ) . '" /></form> |
|
419 | +function twenty_twenty_one_password_form($output, $post = 0) { |
|
420 | + $post = get_post($post); |
|
421 | + $label = 'pwbox-'.(empty($post->ID) ? wp_rand() : $post->ID); |
|
422 | + $output = '<p class="post-password-message">'.esc_html__('This content is password protected. Please enter a password to view.', 'twentytwentyone').'</p> |
|
423 | + <form action="' . esc_url(site_url('wp-login.php?action=postpass', 'login_post')).'" class="post-password-form" method="post"> |
|
424 | + <label class="post-password-form__label" for="' . esc_attr($label).'">'.esc_html_x('Password', 'Post password form', 'twentytwentyone').'</label><input class="post-password-form__input" name="post_password" id="'.esc_attr($label).'" type="password" size="20" /><input type="submit" class="post-password-form__submit" name="'.esc_attr_x('Submit', 'Post password form', 'twentytwentyone').'" value="'.esc_attr_x('Enter', 'Post password form', 'twentytwentyone').'" /></form> |
|
425 | 425 | '; |
426 | 426 | return $output; |
427 | 427 | } |
428 | -add_filter( 'the_password_form', 'twenty_twenty_one_password_form', 10, 2 ); |
|
428 | +add_filter('the_password_form', 'twenty_twenty_one_password_form', 10, 2); |
|
429 | 429 | |
430 | 430 | /** |
431 | 431 | * Filters the list of attachment image attributes. |
@@ -439,37 +439,37 @@ discard block |
||
439 | 439 | * an array of width and height values in pixels (in that order). |
440 | 440 | * @return string[] The filtered attributes for the image markup. |
441 | 441 | */ |
442 | -function twenty_twenty_one_get_attachment_image_attributes( $attr, $attachment, $size ) { |
|
442 | +function twenty_twenty_one_get_attachment_image_attributes($attr, $attachment, $size) { |
|
443 | 443 | |
444 | - if ( is_admin() ) { |
|
444 | + if (is_admin()) { |
|
445 | 445 | return $attr; |
446 | 446 | } |
447 | 447 | |
448 | - if ( isset( $attr['class'] ) && false !== strpos( $attr['class'], 'custom-logo' ) ) { |
|
448 | + if (isset($attr['class']) && false !== strpos($attr['class'], 'custom-logo')) { |
|
449 | 449 | return $attr; |
450 | 450 | } |
451 | 451 | |
452 | 452 | $width = false; |
453 | 453 | $height = false; |
454 | 454 | |
455 | - if ( is_array( $size ) ) { |
|
455 | + if (is_array($size)) { |
|
456 | 456 | $width = (int) $size[0]; |
457 | 457 | $height = (int) $size[1]; |
458 | - } elseif ( $attachment && is_object( $attachment ) && $attachment->ID ) { |
|
459 | - $meta = wp_get_attachment_metadata( $attachment->ID ); |
|
460 | - if ( isset( $meta['width'] ) && isset( $meta['height'] ) ) { |
|
458 | + } elseif ($attachment && is_object($attachment) && $attachment->ID) { |
|
459 | + $meta = wp_get_attachment_metadata($attachment->ID); |
|
460 | + if (isset($meta['width']) && isset($meta['height'])) { |
|
461 | 461 | $width = (int) $meta['width']; |
462 | 462 | $height = (int) $meta['height']; |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | - if ( $width && $height ) { |
|
466 | + if ($width && $height) { |
|
467 | 467 | |
468 | 468 | // Add style. |
469 | - $attr['style'] = isset( $attr['style'] ) ? $attr['style'] : ''; |
|
470 | - $attr['style'] = 'width:100%;height:' . round( 100 * $height / $width, 2 ) . '%;max-width:' . $width . 'px;' . $attr['style']; |
|
469 | + $attr['style'] = isset($attr['style']) ? $attr['style'] : ''; |
|
470 | + $attr['style'] = 'width:100%;height:'.round(100 * $height / $width, 2).'%;max-width:'.$width.'px;'.$attr['style']; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | return $attr; |
474 | 474 | } |
475 | -add_filter( 'wp_get_attachment_image_attributes', 'twenty_twenty_one_get_attachment_image_attributes', 10, 3 ); |
|
475 | +add_filter('wp_get_attachment_image_attributes', 'twenty_twenty_one_get_attachment_image_attributes', 10, 3); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * @return void |
20 | 20 | */ |
21 | 21 | function twenty_twenty_one_switch_theme() { |
22 | - add_action( 'admin_notices', 'twenty_twenty_one_upgrade_notice' ); |
|
22 | + add_action('admin_notices', 'twenty_twenty_one_upgrade_notice'); |
|
23 | 23 | } |
24 | -add_action( 'after_switch_theme', 'twenty_twenty_one_switch_theme' ); |
|
24 | +add_action('after_switch_theme', 'twenty_twenty_one_switch_theme'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Adds a message for unsuccessful theme switch. |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | echo '<div class="error"><p>'; |
40 | 40 | printf( |
41 | 41 | /* translators: %s: WordPress Version. */ |
42 | - esc_html__( 'This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone' ), |
|
43 | - esc_html( $GLOBALS['wp_version'] ) |
|
42 | + esc_html__('This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone'), |
|
43 | + esc_html($GLOBALS['wp_version']) |
|
44 | 44 | ); |
45 | 45 | echo '</p></div>'; |
46 | 46 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | wp_die( |
59 | 59 | sprintf( |
60 | 60 | /* translators: %s: WordPress Version. */ |
61 | - esc_html__( 'This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone' ), |
|
62 | - esc_html( $GLOBALS['wp_version'] ) |
|
61 | + esc_html__('This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone'), |
|
62 | + esc_html($GLOBALS['wp_version']) |
|
63 | 63 | ), |
64 | 64 | '', |
65 | 65 | array( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ) |
68 | 68 | ); |
69 | 69 | } |
70 | -add_action( 'load-customize.php', 'twenty_twenty_one_customize' ); |
|
70 | +add_action('load-customize.php', 'twenty_twenty_one_customize'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Prevents the Theme Preview from being loaded on WordPress versions prior to 5.3. |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | function twenty_twenty_one_preview() { |
82 | - if ( isset( $_GET['preview'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
82 | + if (isset($_GET['preview'])) { // phpcs:ignore WordPress.Security.NonceVerification |
|
83 | 83 | wp_die( |
84 | 84 | sprintf( |
85 | 85 | /* translators: %s: WordPress Version. */ |
86 | - esc_html__( 'This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone' ), |
|
87 | - esc_html( $GLOBALS['wp_version'] ) |
|
86 | + esc_html__('This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone'), |
|
87 | + esc_html($GLOBALS['wp_version']) |
|
88 | 88 | ) |
89 | 89 | ); |
90 | 90 | } |
91 | 91 | } |
92 | -add_action( 'template_redirect', 'twenty_twenty_one_preview' ); |
|
92 | +add_action('template_redirect', 'twenty_twenty_one_preview'); |