@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Twenty Seventeen only works in WordPress 4.7 or later. |
14 | 14 | */ |
15 | -if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '<' ) ) { |
|
16 | - require get_template_directory() . '/inc/back-compat.php'; |
|
15 | +if (version_compare($GLOBALS['wp_version'], '4.7-alpha', '<')) { |
|
16 | + require get_template_directory().'/inc/back-compat.php'; |
|
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * If you're building a theme based on Twenty Seventeen, use a find and replace |
32 | 32 | * to change 'twentyseventeen' to the name of your theme in all the template files. |
33 | 33 | */ |
34 | - load_theme_textdomain( 'twentyseventeen' ); |
|
34 | + load_theme_textdomain('twentyseventeen'); |
|
35 | 35 | |
36 | 36 | // Add default posts and comments RSS feed links to head. |
37 | - add_theme_support( 'automatic-feed-links' ); |
|
37 | + add_theme_support('automatic-feed-links'); |
|
38 | 38 | |
39 | 39 | /* |
40 | 40 | * Let WordPress manage the document title. |
@@ -42,45 +42,45 @@ discard block |
||
42 | 42 | * hard-coded <title> tag in the document head, and expect WordPress to |
43 | 43 | * provide it for us. |
44 | 44 | */ |
45 | - add_theme_support( 'title-tag' ); |
|
45 | + add_theme_support('title-tag'); |
|
46 | 46 | |
47 | 47 | /* |
48 | 48 | * Enable support for Post Thumbnails on posts and pages. |
49 | 49 | * |
50 | 50 | * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ |
51 | 51 | */ |
52 | - add_theme_support( 'post-thumbnails' ); |
|
52 | + add_theme_support('post-thumbnails'); |
|
53 | 53 | |
54 | - add_image_size( 'twentyseventeen-featured-image', 2000, 1200, true ); |
|
54 | + add_image_size('twentyseventeen-featured-image', 2000, 1200, true); |
|
55 | 55 | |
56 | - add_image_size( 'twentyseventeen-thumbnail-avatar', 100, 100, true ); |
|
56 | + add_image_size('twentyseventeen-thumbnail-avatar', 100, 100, true); |
|
57 | 57 | |
58 | 58 | // Set the default content width. |
59 | 59 | $GLOBALS['content_width'] = 525; |
60 | 60 | |
61 | 61 | // This theme uses wp_nav_menu() in two locations. |
62 | - register_nav_menus( array( |
|
63 | - 'top' => __( 'Top Menu', 'twentyseventeen' ), |
|
64 | - 'social' => __( 'Social Links Menu', 'twentyseventeen' ), |
|
65 | - ) ); |
|
62 | + register_nav_menus(array( |
|
63 | + 'top' => __('Top Menu', 'twentyseventeen'), |
|
64 | + 'social' => __('Social Links Menu', 'twentyseventeen'), |
|
65 | + )); |
|
66 | 66 | |
67 | 67 | /* |
68 | 68 | * Switch default core markup for search form, comment form, and comments |
69 | 69 | * to output valid HTML5. |
70 | 70 | */ |
71 | - add_theme_support( 'html5', array( |
|
71 | + add_theme_support('html5', array( |
|
72 | 72 | 'comment-form', |
73 | 73 | 'comment-list', |
74 | 74 | 'gallery', |
75 | 75 | 'caption', |
76 | - ) ); |
|
76 | + )); |
|
77 | 77 | |
78 | 78 | /* |
79 | 79 | * Enable support for Post Formats. |
80 | 80 | * |
81 | 81 | * See: https://codex.wordpress.org/Post_Formats |
82 | 82 | */ |
83 | - add_theme_support( 'post-formats', array( |
|
83 | + add_theme_support('post-formats', array( |
|
84 | 84 | 'aside', |
85 | 85 | 'image', |
86 | 86 | 'video', |
@@ -88,23 +88,23 @@ discard block |
||
88 | 88 | 'link', |
89 | 89 | 'gallery', |
90 | 90 | 'audio', |
91 | - ) ); |
|
91 | + )); |
|
92 | 92 | |
93 | 93 | // Add theme support for Custom Logo. |
94 | - add_theme_support( 'custom-logo', array( |
|
94 | + add_theme_support('custom-logo', array( |
|
95 | 95 | 'width' => 250, |
96 | 96 | 'height' => 250, |
97 | 97 | 'flex-width' => true, |
98 | - ) ); |
|
98 | + )); |
|
99 | 99 | |
100 | 100 | // Add theme support for selective refresh for widgets. |
101 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
101 | + add_theme_support('customize-selective-refresh-widgets'); |
|
102 | 102 | |
103 | 103 | /* |
104 | 104 | * This theme styles the visual editor to resemble the theme style, |
105 | 105 | * specifically font, colors, and column width. |
106 | 106 | */ |
107 | - add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) ); |
|
107 | + add_editor_style(array('assets/css/editor-style.css', twentyseventeen_fonts_url())); |
|
108 | 108 | |
109 | 109 | // Define and register starter content to showcase the theme on new sites. |
110 | 110 | $starter_content = array( |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | // Create the custom image attachments used as post thumbnails for pages. |
149 | 149 | 'attachments' => array( |
150 | 150 | 'image-espresso' => array( |
151 | - 'post_title' => _x( 'Espresso', 'Theme starter content', 'twentyseventeen' ), |
|
151 | + 'post_title' => _x('Espresso', 'Theme starter content', 'twentyseventeen'), |
|
152 | 152 | 'file' => 'assets/images/espresso.jpg', // URL relative to the template directory. |
153 | 153 | ), |
154 | 154 | 'image-sandwich' => array( |
155 | - 'post_title' => _x( 'Sandwich', 'Theme starter content', 'twentyseventeen' ), |
|
155 | + 'post_title' => _x('Sandwich', 'Theme starter content', 'twentyseventeen'), |
|
156 | 156 | 'file' => 'assets/images/sandwich.jpg', |
157 | 157 | ), |
158 | 158 | 'image-coffee' => array( |
159 | - 'post_title' => _x( 'Coffee', 'Theme starter content', 'twentyseventeen' ), |
|
159 | + 'post_title' => _x('Coffee', 'Theme starter content', 'twentyseventeen'), |
|
160 | 160 | 'file' => 'assets/images/coffee.jpg', |
161 | 161 | ), |
162 | 162 | ), |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'nav_menus' => array( |
181 | 181 | // Assign a menu to the "top" location. |
182 | 182 | 'top' => array( |
183 | - 'name' => __( 'Top Menu', 'twentyseventeen' ), |
|
183 | + 'name' => __('Top Menu', 'twentyseventeen'), |
|
184 | 184 | 'items' => array( |
185 | 185 | 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. |
186 | 186 | 'page_about', |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | // Assign a menu to the "social" location. |
193 | 193 | 'social' => array( |
194 | - 'name' => __( 'Social Links Menu', 'twentyseventeen' ), |
|
194 | + 'name' => __('Social Links Menu', 'twentyseventeen'), |
|
195 | 195 | 'items' => array( |
196 | 196 | 'link_yelp', |
197 | 197 | 'link_facebook', |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @param array $starter_content Array of starter content. |
212 | 212 | */ |
213 | - $starter_content = apply_filters( 'twentyseventeen_starter_content', $starter_content ); |
|
213 | + $starter_content = apply_filters('twentyseventeen_starter_content', $starter_content); |
|
214 | 214 | |
215 | - add_theme_support( 'starter-content', $starter_content ); |
|
215 | + add_theme_support('starter-content', $starter_content); |
|
216 | 216 | } |
217 | -add_action( 'after_setup_theme', 'twentyseventeen_setup' ); |
|
217 | +add_action('after_setup_theme', 'twentyseventeen_setup'); |
|
218 | 218 | |
219 | 219 | /** |
220 | 220 | * Set the content width in pixels, based on the theme's design and stylesheet. |
@@ -228,19 +228,19 @@ discard block |
||
228 | 228 | $content_width = $GLOBALS['content_width']; |
229 | 229 | |
230 | 230 | // Get layout. |
231 | - $page_layout = get_theme_mod( 'page_layout' ); |
|
231 | + $page_layout = get_theme_mod('page_layout'); |
|
232 | 232 | |
233 | 233 | // Check if layout is one column. |
234 | - if ( 'one-column' === $page_layout ) { |
|
235 | - if ( twentyseventeen_is_frontpage() ) { |
|
234 | + if ('one-column' === $page_layout) { |
|
235 | + if (twentyseventeen_is_frontpage()) { |
|
236 | 236 | $content_width = 644; |
237 | - } elseif ( is_page() ) { |
|
237 | + } elseif (is_page()) { |
|
238 | 238 | $content_width = 740; |
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | 242 | // Check if is single post and there is no sidebar. |
243 | - if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) { |
|
243 | + if (is_single() && ! is_active_sidebar('sidebar-1')) { |
|
244 | 244 | $content_width = 740; |
245 | 245 | } |
246 | 246 | |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @param $content_width integer |
253 | 253 | */ |
254 | - $GLOBALS['content_width'] = apply_filters( 'twentyseventeen_content_width', $content_width ); |
|
254 | + $GLOBALS['content_width'] = apply_filters('twentyseventeen_content_width', $content_width); |
|
255 | 255 | } |
256 | -add_action( 'template_redirect', 'twentyseventeen_content_width', 0 ); |
|
256 | +add_action('template_redirect', 'twentyseventeen_content_width', 0); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Register custom fonts. |
@@ -266,22 +266,22 @@ discard block |
||
266 | 266 | * supported by Libre Franklin, translate this to 'off'. Do not translate |
267 | 267 | * into your own language. |
268 | 268 | */ |
269 | - $libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'twentyseventeen' ); |
|
269 | + $libre_franklin = _x('on', 'Libre Franklin font: on or off', 'twentyseventeen'); |
|
270 | 270 | |
271 | - if ( 'off' !== $libre_franklin ) { |
|
271 | + if ('off' !== $libre_franklin) { |
|
272 | 272 | $font_families = array(); |
273 | 273 | |
274 | 274 | $font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i'; |
275 | 275 | |
276 | 276 | $query_args = array( |
277 | - 'family' => urlencode( implode( '|', $font_families ) ), |
|
278 | - 'subset' => urlencode( 'latin,latin-ext' ), |
|
277 | + 'family' => urlencode(implode('|', $font_families)), |
|
278 | + 'subset' => urlencode('latin,latin-ext'), |
|
279 | 279 | ); |
280 | 280 | |
281 | - $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); |
|
281 | + $fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); |
|
282 | 282 | } |
283 | 283 | |
284 | - return esc_url_raw( $fonts_url ); |
|
284 | + return esc_url_raw($fonts_url); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | * @param string $relation_type The relation type the URLs are printed. |
294 | 294 | * @return array $urls URLs to print for resource hints. |
295 | 295 | */ |
296 | -function twentyseventeen_resource_hints( $urls, $relation_type ) { |
|
297 | - if ( wp_style_is( 'twentyseventeen-fonts', 'queue' ) && 'preconnect' === $relation_type ) { |
|
296 | +function twentyseventeen_resource_hints($urls, $relation_type) { |
|
297 | + if (wp_style_is('twentyseventeen-fonts', 'queue') && 'preconnect' === $relation_type) { |
|
298 | 298 | $urls[] = array( |
299 | 299 | 'href' => 'https://fonts.gstatic.com', |
300 | 300 | 'crossorigin', |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | return $urls; |
305 | 305 | } |
306 | -add_filter( 'wp_resource_hints', 'twentyseventeen_resource_hints', 10, 2 ); |
|
306 | +add_filter('wp_resource_hints', 'twentyseventeen_resource_hints', 10, 2); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Register widget area. |
@@ -311,37 +311,37 @@ discard block |
||
311 | 311 | * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar |
312 | 312 | */ |
313 | 313 | function twentyseventeen_widgets_init() { |
314 | - register_sidebar( array( |
|
315 | - 'name' => __( 'Sidebar', 'twentyseventeen' ), |
|
314 | + register_sidebar(array( |
|
315 | + 'name' => __('Sidebar', 'twentyseventeen'), |
|
316 | 316 | 'id' => 'sidebar-1', |
317 | - 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyseventeen' ), |
|
317 | + 'description' => __('Add widgets here to appear in your sidebar.', 'twentyseventeen'), |
|
318 | 318 | 'before_widget' => '<section id="%1$s" class="widget %2$s">', |
319 | 319 | 'after_widget' => '</section>', |
320 | 320 | 'before_title' => '<h2 class="widget-title">', |
321 | 321 | 'after_title' => '</h2>', |
322 | - ) ); |
|
322 | + )); |
|
323 | 323 | |
324 | - register_sidebar( array( |
|
325 | - 'name' => __( 'Footer 1', 'twentyseventeen' ), |
|
324 | + register_sidebar(array( |
|
325 | + 'name' => __('Footer 1', 'twentyseventeen'), |
|
326 | 326 | 'id' => 'sidebar-2', |
327 | - 'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ), |
|
327 | + 'description' => __('Add widgets here to appear in your footer.', 'twentyseventeen'), |
|
328 | 328 | 'before_widget' => '<section id="%1$s" class="widget %2$s">', |
329 | 329 | 'after_widget' => '</section>', |
330 | 330 | 'before_title' => '<h2 class="widget-title">', |
331 | 331 | 'after_title' => '</h2>', |
332 | - ) ); |
|
332 | + )); |
|
333 | 333 | |
334 | - register_sidebar( array( |
|
335 | - 'name' => __( 'Footer 2', 'twentyseventeen' ), |
|
334 | + register_sidebar(array( |
|
335 | + 'name' => __('Footer 2', 'twentyseventeen'), |
|
336 | 336 | 'id' => 'sidebar-3', |
337 | - 'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ), |
|
337 | + 'description' => __('Add widgets here to appear in your footer.', 'twentyseventeen'), |
|
338 | 338 | 'before_widget' => '<section id="%1$s" class="widget %2$s">', |
339 | 339 | 'after_widget' => '</section>', |
340 | 340 | 'before_title' => '<h2 class="widget-title">', |
341 | 341 | 'after_title' => '</h2>', |
342 | - ) ); |
|
342 | + )); |
|
343 | 343 | } |
344 | -add_action( 'widgets_init', 'twentyseventeen_widgets_init' ); |
|
344 | +add_action('widgets_init', 'twentyseventeen_widgets_init'); |
|
345 | 345 | |
346 | 346 | /** |
347 | 347 | * Replaces "[...]" (appended to automatically generated excerpts) with ... and |
@@ -352,19 +352,19 @@ discard block |
||
352 | 352 | * @param string $link Link to single post/page. |
353 | 353 | * @return string 'Continue reading' link prepended with an ellipsis. |
354 | 354 | */ |
355 | -function twentyseventeen_excerpt_more( $link ) { |
|
356 | - if ( is_admin() ) { |
|
355 | +function twentyseventeen_excerpt_more($link) { |
|
356 | + if (is_admin()) { |
|
357 | 357 | return $link; |
358 | 358 | } |
359 | 359 | |
360 | - $link = sprintf( '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>', |
|
361 | - esc_url( get_permalink( get_the_ID() ) ), |
|
360 | + $link = sprintf('<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>', |
|
361 | + esc_url(get_permalink(get_the_ID())), |
|
362 | 362 | /* translators: %s: Name of current post */ |
363 | - sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), get_the_title( get_the_ID() ) ) |
|
363 | + sprintf(__('Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen'), get_the_title(get_the_ID())) |
|
364 | 364 | ); |
365 | - return ' … ' . $link; |
|
365 | + return ' … '.$link; |
|
366 | 366 | } |
367 | -add_filter( 'excerpt_more', 'twentyseventeen_excerpt_more' ); |
|
367 | +add_filter('excerpt_more', 'twentyseventeen_excerpt_more'); |
|
368 | 368 | |
369 | 369 | /** |
370 | 370 | * Handles JavaScript detection. |
@@ -376,88 +376,88 @@ discard block |
||
376 | 376 | function twentyseventeen_javascript_detection() { |
377 | 377 | echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
378 | 378 | } |
379 | -add_action( 'wp_head', 'twentyseventeen_javascript_detection', 0 ); |
|
379 | +add_action('wp_head', 'twentyseventeen_javascript_detection', 0); |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Add a pingback url auto-discovery header for singularly identifiable articles. |
383 | 383 | */ |
384 | 384 | function twentyseventeen_pingback_header() { |
385 | - if ( is_singular() && pings_open() ) { |
|
386 | - printf( '<link rel="pingback" href="%s">' . "\n", get_bloginfo( 'pingback_url' ) ); |
|
385 | + if (is_singular() && pings_open()) { |
|
386 | + printf('<link rel="pingback" href="%s">'."\n", get_bloginfo('pingback_url')); |
|
387 | 387 | } |
388 | 388 | } |
389 | -add_action( 'wp_head', 'twentyseventeen_pingback_header' ); |
|
389 | +add_action('wp_head', 'twentyseventeen_pingback_header'); |
|
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Display custom color CSS. |
393 | 393 | */ |
394 | 394 | function twentyseventeen_colors_css_wrap() { |
395 | - if ( 'custom' !== get_theme_mod( 'colorscheme' ) && ! is_customize_preview() ) { |
|
395 | + if ('custom' !== get_theme_mod('colorscheme') && ! is_customize_preview()) { |
|
396 | 396 | return; |
397 | 397 | } |
398 | 398 | |
399 | - require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) ); |
|
400 | - $hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) ); |
|
399 | + require_once(get_parent_theme_file_path('/inc/color-patterns.php')); |
|
400 | + $hue = absint(get_theme_mod('colorscheme_hue', 250)); |
|
401 | 401 | ?> |
402 | - <style type="text/css" id="custom-theme-colors" <?php if ( is_customize_preview() ) { echo 'data-hue="' . $hue . '"'; } ?>> |
|
402 | + <style type="text/css" id="custom-theme-colors" <?php if (is_customize_preview()) { echo 'data-hue="'.$hue.'"'; } ?>> |
|
403 | 403 | <?php echo twentyseventeen_custom_colors_css(); ?> |
404 | 404 | </style> |
405 | 405 | <?php } |
406 | -add_action( 'wp_head', 'twentyseventeen_colors_css_wrap' ); |
|
406 | +add_action('wp_head', 'twentyseventeen_colors_css_wrap'); |
|
407 | 407 | |
408 | 408 | /** |
409 | 409 | * Enqueue scripts and styles. |
410 | 410 | */ |
411 | 411 | function twentyseventeen_scripts() { |
412 | 412 | // Add custom fonts, used in the main stylesheet. |
413 | - wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null ); |
|
413 | + wp_enqueue_style('twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null); |
|
414 | 414 | |
415 | 415 | // Theme stylesheet. |
416 | - wp_enqueue_style( 'twentyseventeen-style', get_stylesheet_uri() ); |
|
416 | + wp_enqueue_style('twentyseventeen-style', get_stylesheet_uri()); |
|
417 | 417 | |
418 | 418 | // Load the dark colorscheme. |
419 | - if ( 'dark' === get_theme_mod( 'colorscheme', 'light' ) || is_customize_preview() ) { |
|
420 | - wp_enqueue_style( 'twentyseventeen-colors-dark', get_theme_file_uri( '/assets/css/colors-dark.css' ), array( 'twentyseventeen-style' ), '1.0' ); |
|
419 | + if ('dark' === get_theme_mod('colorscheme', 'light') || is_customize_preview()) { |
|
420 | + wp_enqueue_style('twentyseventeen-colors-dark', get_theme_file_uri('/assets/css/colors-dark.css'), array('twentyseventeen-style'), '1.0'); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | // Load the Internet Explorer 9 specific stylesheet, to fix display issues in the Customizer. |
424 | - if ( is_customize_preview() ) { |
|
425 | - wp_enqueue_style( 'twentyseventeen-ie9', get_theme_file_uri( '/assets/css/ie9.css' ), array( 'twentyseventeen-style' ), '1.0' ); |
|
426 | - wp_style_add_data( 'twentyseventeen-ie9', 'conditional', 'IE 9' ); |
|
424 | + if (is_customize_preview()) { |
|
425 | + wp_enqueue_style('twentyseventeen-ie9', get_theme_file_uri('/assets/css/ie9.css'), array('twentyseventeen-style'), '1.0'); |
|
426 | + wp_style_add_data('twentyseventeen-ie9', 'conditional', 'IE 9'); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | // Load the Internet Explorer 8 specific stylesheet. |
430 | - wp_enqueue_style( 'twentyseventeen-ie8', get_theme_file_uri( '/assets/css/ie8.css' ), array( 'twentyseventeen-style' ), '1.0' ); |
|
431 | - wp_style_add_data( 'twentyseventeen-ie8', 'conditional', 'lt IE 9' ); |
|
430 | + wp_enqueue_style('twentyseventeen-ie8', get_theme_file_uri('/assets/css/ie8.css'), array('twentyseventeen-style'), '1.0'); |
|
431 | + wp_style_add_data('twentyseventeen-ie8', 'conditional', 'lt IE 9'); |
|
432 | 432 | |
433 | 433 | // Load the html5 shiv. |
434 | - wp_enqueue_script( 'html5', get_theme_file_uri( '/assets/js/html5.js' ), array(), '3.7.3' ); |
|
435 | - wp_script_add_data( 'html5', 'conditional', 'lt IE 9' ); |
|
434 | + wp_enqueue_script('html5', get_theme_file_uri('/assets/js/html5.js'), array(), '3.7.3'); |
|
435 | + wp_script_add_data('html5', 'conditional', 'lt IE 9'); |
|
436 | 436 | |
437 | - wp_enqueue_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '1.0', true ); |
|
437 | + wp_enqueue_script('twentyseventeen-skip-link-focus-fix', get_theme_file_uri('/assets/js/skip-link-focus-fix.js'), array(), '1.0', true); |
|
438 | 438 | |
439 | 439 | $twentyseventeen_l10n = array( |
440 | - 'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ), |
|
440 | + 'quote' => twentyseventeen_get_svg(array('icon' => 'quote-right')), |
|
441 | 441 | ); |
442 | 442 | |
443 | - if ( has_nav_menu( 'top' ) ) { |
|
444 | - wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '1.0', true ); |
|
445 | - $twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' ); |
|
446 | - $twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' ); |
|
447 | - $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) ); |
|
443 | + if (has_nav_menu('top')) { |
|
444 | + wp_enqueue_script('twentyseventeen-navigation', get_theme_file_uri('/assets/js/navigation.js'), array(), '1.0', true); |
|
445 | + $twentyseventeen_l10n['expand'] = __('Expand child menu', 'twentyseventeen'); |
|
446 | + $twentyseventeen_l10n['collapse'] = __('Collapse child menu', 'twentyseventeen'); |
|
447 | + $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg(array('icon' => 'angle-down', 'fallback' => true)); |
|
448 | 448 | } |
449 | 449 | |
450 | - wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '1.0', true ); |
|
450 | + wp_enqueue_script('twentyseventeen-global', get_theme_file_uri('/assets/js/global.js'), array('jquery'), '1.0', true); |
|
451 | 451 | |
452 | - wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.2', true ); |
|
452 | + wp_enqueue_script('jquery-scrollto', get_theme_file_uri('/assets/js/jquery.scrollTo.js'), array('jquery'), '2.1.2', true); |
|
453 | 453 | |
454 | - wp_localize_script( 'twentyseventeen-skip-link-focus-fix', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n ); |
|
454 | + wp_localize_script('twentyseventeen-skip-link-focus-fix', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n); |
|
455 | 455 | |
456 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
457 | - wp_enqueue_script( 'comment-reply' ); |
|
456 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
457 | + wp_enqueue_script('comment-reply'); |
|
458 | 458 | } |
459 | 459 | } |
460 | -add_action( 'wp_enqueue_scripts', 'twentyseventeen_scripts' ); |
|
460 | +add_action('wp_enqueue_scripts', 'twentyseventeen_scripts'); |
|
461 | 461 | |
462 | 462 | /** |
463 | 463 | * Add custom image sizes attribute to enhance responsive image functionality |
@@ -470,22 +470,22 @@ discard block |
||
470 | 470 | * values in pixels (in that order). |
471 | 471 | * @return string A source size value for use in a content image 'sizes' attribute. |
472 | 472 | */ |
473 | -function twentyseventeen_content_image_sizes_attr( $sizes, $size ) { |
|
473 | +function twentyseventeen_content_image_sizes_attr($sizes, $size) { |
|
474 | 474 | $width = $size[0]; |
475 | 475 | |
476 | - if ( 740 <= $width ) { |
|
476 | + if (740 <= $width) { |
|
477 | 477 | $sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px'; |
478 | 478 | } |
479 | 479 | |
480 | - if ( is_active_sidebar( 'sidebar-1' ) || is_archive() || is_search() || is_home() || is_page() ) { |
|
481 | - if ( ! ( is_page() && 'one-column' === get_theme_mod( 'page_options' ) ) && 767 <= $width ) { |
|
480 | + if (is_active_sidebar('sidebar-1') || is_archive() || is_search() || is_home() || is_page()) { |
|
481 | + if ( ! (is_page() && 'one-column' === get_theme_mod('page_options')) && 767 <= $width) { |
|
482 | 482 | $sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px'; |
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
486 | 486 | return $sizes; |
487 | 487 | } |
488 | -add_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_attr', 10, 2 ); |
|
488 | +add_filter('wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_attr', 10, 2); |
|
489 | 489 | |
490 | 490 | /** |
491 | 491 | * Filter the `sizes` value in the header image markup. |
@@ -497,13 +497,13 @@ discard block |
||
497 | 497 | * @param array $attr Array of the attributes for the image tag. |
498 | 498 | * @return string The filtered header image HTML. |
499 | 499 | */ |
500 | -function twentyseventeen_header_image_tag( $html, $header, $attr ) { |
|
501 | - if ( isset( $attr['sizes'] ) ) { |
|
502 | - $html = str_replace( $attr['sizes'], '100vw', $html ); |
|
500 | +function twentyseventeen_header_image_tag($html, $header, $attr) { |
|
501 | + if (isset($attr['sizes'])) { |
|
502 | + $html = str_replace($attr['sizes'], '100vw', $html); |
|
503 | 503 | } |
504 | 504 | return $html; |
505 | 505 | } |
506 | -add_filter( 'get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3 ); |
|
506 | +add_filter('get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3); |
|
507 | 507 | |
508 | 508 | /** |
509 | 509 | * Add custom image sizes attribute to enhance responsive image functionality |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | * @param array $size Registered image size or flat array of height and width dimensions. |
517 | 517 | * @return string A source size value for use in a post thumbnail 'sizes' attribute. |
518 | 518 | */ |
519 | -function twentyseventeen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) { |
|
520 | - if ( is_archive() || is_search() || is_home() ) { |
|
519 | +function twentyseventeen_post_thumbnail_sizes_attr($attr, $attachment, $size) { |
|
520 | + if (is_archive() || is_search() || is_home()) { |
|
521 | 521 | $attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px'; |
522 | 522 | } else { |
523 | 523 | $attr['sizes'] = '100vw'; |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | return $attr; |
527 | 527 | } |
528 | -add_filter( 'wp_get_attachment_image_attributes', 'twentyseventeen_post_thumbnail_sizes_attr', 10, 3 ); |
|
528 | +add_filter('wp_get_attachment_image_attributes', 'twentyseventeen_post_thumbnail_sizes_attr', 10, 3); |
|
529 | 529 | |
530 | 530 | /** |
531 | 531 | * Use front-page.php when Front page displays is set to a static page. |
@@ -536,32 +536,32 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @return string The template to be used: blank if is_home() is true (defaults to index.php), else $template. |
538 | 538 | */ |
539 | -function twentyseventeen_front_page_template( $template ) { |
|
539 | +function twentyseventeen_front_page_template($template) { |
|
540 | 540 | return is_home() ? '' : $template; |
541 | 541 | } |
542 | -add_filter( 'frontpage_template', 'twentyseventeen_front_page_template' ); |
|
542 | +add_filter('frontpage_template', 'twentyseventeen_front_page_template'); |
|
543 | 543 | |
544 | 544 | /** |
545 | 545 | * Implement the Custom Header feature. |
546 | 546 | */ |
547 | -require get_parent_theme_file_path( '/inc/custom-header.php' ); |
|
547 | +require get_parent_theme_file_path('/inc/custom-header.php'); |
|
548 | 548 | |
549 | 549 | /** |
550 | 550 | * Custom template tags for this theme. |
551 | 551 | */ |
552 | -require get_parent_theme_file_path( '/inc/template-tags.php' ); |
|
552 | +require get_parent_theme_file_path('/inc/template-tags.php'); |
|
553 | 553 | |
554 | 554 | /** |
555 | 555 | * Additional features to allow styling of the templates. |
556 | 556 | */ |
557 | -require get_parent_theme_file_path( '/inc/template-functions.php' ); |
|
557 | +require get_parent_theme_file_path('/inc/template-functions.php'); |
|
558 | 558 | |
559 | 559 | /** |
560 | 560 | * Customizer additions. |
561 | 561 | */ |
562 | -require get_parent_theme_file_path( '/inc/customizer.php' ); |
|
562 | +require get_parent_theme_file_path('/inc/customizer.php'); |
|
563 | 563 | |
564 | 564 | /** |
565 | 565 | * SVG icons functions and filters. |
566 | 566 | */ |
567 | -require get_parent_theme_file_path( '/inc/icon-functions.php' ); |
|
567 | +require get_parent_theme_file_path('/inc/icon-functions.php'); |
@@ -22,12 +22,12 @@ |
||
22 | 22 | <main id="main" class="site-main" role="main"> |
23 | 23 | |
24 | 24 | <?php |
25 | - while ( have_posts() ) : the_post(); |
|
25 | + while (have_posts()) : the_post(); |
|
26 | 26 | |
27 | - get_template_part( 'template-parts/page/content', 'page' ); |
|
27 | + get_template_part('template-parts/page/content', 'page'); |
|
28 | 28 | |
29 | 29 | // If comments are open or we have at least one comment, load up the comment template. |
30 | - if ( comments_open() || get_comments_number() ) : |
|
30 | + if (comments_open() || get_comments_number()) : |
|
31 | 31 | comments_template(); |
32 | 32 | endif; |
33 | 33 |
@@ -13,40 +13,40 @@ discard block |
||
13 | 13 | * @param array $classes Classes for the body element. |
14 | 14 | * @return array |
15 | 15 | */ |
16 | -function twentyseventeen_body_classes( $classes ) { |
|
16 | +function twentyseventeen_body_classes($classes) { |
|
17 | 17 | // Add class of group-blog to blogs with more than 1 published author. |
18 | - if ( is_multi_author() ) { |
|
18 | + if (is_multi_author()) { |
|
19 | 19 | $classes[] = 'group-blog'; |
20 | 20 | } |
21 | 21 | |
22 | 22 | // Add class of hfeed to non-singular pages. |
23 | - if ( ! is_singular() ) { |
|
23 | + if ( ! is_singular()) { |
|
24 | 24 | $classes[] = 'hfeed'; |
25 | 25 | } |
26 | 26 | |
27 | 27 | // Add class if we're viewing the Customizer for easier styling of theme options. |
28 | - if ( is_customize_preview() ) { |
|
28 | + if (is_customize_preview()) { |
|
29 | 29 | $classes[] = 'twentyseventeen-customizer'; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Add class on front page. |
33 | - if ( is_front_page() && 'posts' !== get_option( 'show_on_front' ) ) { |
|
33 | + if (is_front_page() && 'posts' !== get_option('show_on_front')) { |
|
34 | 34 | $classes[] = 'twentyseventeen-front-page'; |
35 | 35 | } |
36 | 36 | |
37 | 37 | // Add a class if there is a custom header. |
38 | - if ( has_header_image() ) { |
|
38 | + if (has_header_image()) { |
|
39 | 39 | $classes[] = 'has-header-image'; |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Add class if sidebar is used. |
43 | - if ( is_active_sidebar( 'sidebar-1' ) && ! is_page() ) { |
|
43 | + if (is_active_sidebar('sidebar-1') && ! is_page()) { |
|
44 | 44 | $classes[] = 'has-sidebar'; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Add class for one or two column page layouts. |
48 | - if ( is_page() || is_archive() ) { |
|
49 | - if ( 'one-column' === get_theme_mod( 'page_layout' ) ) { |
|
48 | + if (is_page() || is_archive()) { |
|
49 | + if ('one-column' === get_theme_mod('page_layout')) { |
|
50 | 50 | $classes[] = 'page-one-column'; |
51 | 51 | } else { |
52 | 52 | $classes[] = 'page-two-column'; |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Add class if the site title and tagline is hidden. |
57 | - if ( 'blank' === get_header_textcolor() ) { |
|
57 | + if ('blank' === get_header_textcolor()) { |
|
58 | 58 | $classes[] = 'title-tagline-hidden'; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Get the colorscheme or the default if there isn't one. |
62 | - $colors = twentyseventeen_sanitize_colorscheme( get_theme_mod( 'colorscheme', 'light' ) ); |
|
63 | - $classes[] = 'colors-' . $colors; |
|
62 | + $colors = twentyseventeen_sanitize_colorscheme(get_theme_mod('colorscheme', 'light')); |
|
63 | + $classes[] = 'colors-'.$colors; |
|
64 | 64 | |
65 | 65 | return $classes; |
66 | 66 | } |
67 | -add_filter( 'body_class', 'twentyseventeen_body_classes' ); |
|
67 | +add_filter('body_class', 'twentyseventeen_body_classes'); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Count our number of active panels. |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param $num_sections integer |
84 | 84 | */ |
85 | - $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); |
|
85 | + $num_sections = apply_filters('twentyseventeen_front_page_sections', 4); |
|
86 | 86 | |
87 | 87 | // Create a setting and control for each of the sections available in the theme. |
88 | - for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { |
|
89 | - if ( get_theme_mod( 'panel_' . $i ) ) { |
|
88 | + for ($i = 1; $i < (1 + $num_sections); $i++) { |
|
89 | + if (get_theme_mod('panel_'.$i)) { |
|
90 | 90 | $panel_count++; |
91 | 91 | } |
92 | 92 | } |
@@ -98,5 +98,5 @@ discard block |
||
98 | 98 | * Checks to see if we're on the homepage or not. |
99 | 99 | */ |
100 | 100 | function twentyseventeen_is_frontpage() { |
101 | - return ( is_front_page() && ! is_home() ); |
|
101 | + return (is_front_page() && ! is_home()); |
|
102 | 102 | } |
@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | * @type string $flex-height Flex support for height of header. |
34 | 34 | * } |
35 | 35 | */ |
36 | - add_theme_support( 'custom-header', apply_filters( 'twentyseventeen_custom_header_args', array( |
|
37 | - 'default-image' => get_parent_theme_file_uri( '/assets/images/header.jpg' ), |
|
36 | + add_theme_support('custom-header', apply_filters('twentyseventeen_custom_header_args', array( |
|
37 | + 'default-image' => get_parent_theme_file_uri('/assets/images/header.jpg'), |
|
38 | 38 | 'width' => 2000, |
39 | 39 | 'height' => 1200, |
40 | 40 | 'flex-height' => true, |
41 | 41 | 'video' => true, |
42 | 42 | 'wp-head-callback' => 'twentyseventeen_header_style', |
43 | - ) ) ); |
|
43 | + ))); |
|
44 | 44 | |
45 | - register_default_headers( array( |
|
45 | + register_default_headers(array( |
|
46 | 46 | 'default-image' => array( |
47 | 47 | 'url' => '%s/assets/images/header.jpg', |
48 | 48 | 'thumbnail_url' => '%s/assets/images/header.jpg', |
49 | - 'description' => __( 'Default Header Image', 'twentyseventeen' ), |
|
49 | + 'description' => __('Default Header Image', 'twentyseventeen'), |
|
50 | 50 | ), |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | -add_action( 'after_setup_theme', 'twentyseventeen_custom_header_setup' ); |
|
53 | +add_action('after_setup_theme', 'twentyseventeen_custom_header_setup'); |
|
54 | 54 | |
55 | -if ( ! function_exists( 'twentyseventeen_header_style' ) ) : |
|
55 | +if ( ! function_exists('twentyseventeen_header_style')) : |
|
56 | 56 | /** |
57 | 57 | * Styles the header image and text displayed on the blog. |
58 | 58 | * |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | // If no custom options for text are set, let's bail. |
65 | 65 | // get_header_textcolor() options: add_theme_support( 'custom-header' ) is default, hide text (returns 'blank') or any hex value. |
66 | - if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { |
|
66 | + if (get_theme_support('custom-header', 'default-text-color') === $header_text_color) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | <style id="twentyseventeen-custom-header-styles" type="text/css"> |
73 | 73 | <?php |
74 | 74 | // Has the text been hidden? |
75 | - if ( 'blank' === $header_text_color ) : |
|
75 | + if ('blank' === $header_text_color) : |
|
76 | 76 | ?> |
77 | 77 | .site-title, |
78 | 78 | .site-description { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | body.has-header-video.colors-dark .site-description, |
102 | 102 | body.has-header-image.colors-custom .site-description, |
103 | 103 | body.has-header-video.colors-custom .site-description { |
104 | - color: #<?php echo esc_attr( $header_text_color ); ?>; |
|
104 | + color: #<?php echo esc_attr($header_text_color); ?>; |
|
105 | 105 | } |
106 | 106 | <?php endif; ?> |
107 | 107 | </style> |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param array $settings Video settings. |
116 | 116 | */ |
117 | -function twentyseventeen_video_controls( $settings ) { |
|
118 | - $settings['l10n']['play'] = '<span class="screen-reader-text">' . __( 'Play background video', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'play' ) ); |
|
119 | - $settings['l10n']['pause'] = '<span class="screen-reader-text">' . __( 'Pause background video', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'pause' ) ); |
|
117 | +function twentyseventeen_video_controls($settings) { |
|
118 | + $settings['l10n']['play'] = '<span class="screen-reader-text">'.__('Play background video', 'twentyseventeen').'</span>'.twentyseventeen_get_svg(array('icon' => 'play')); |
|
119 | + $settings['l10n']['pause'] = '<span class="screen-reader-text">'.__('Pause background video', 'twentyseventeen').'</span>'.twentyseventeen_get_svg(array('icon' => 'pause')); |
|
120 | 120 | return $settings; |
121 | 121 | } |
122 | -add_filter( 'header_video_settings', 'twentyseventeen_video_controls' ); |
|
122 | +add_filter('header_video_settings', 'twentyseventeen_video_controls'); |
@@ -81,7 +81,8 @@ discard block |
||
81 | 81 | } |
82 | 82 | <?php |
83 | 83 | // If the user has set a custom color for the text use that. |
84 | - else : |
|
84 | + else { |
|
85 | + : |
|
85 | 86 | ?> |
86 | 87 | .site-title a, |
87 | 88 | .colors-dark .site-title a, |
@@ -101,7 +102,9 @@ discard block |
||
101 | 102 | body.has-header-video.colors-dark .site-description, |
102 | 103 | body.has-header-image.colors-custom .site-description, |
103 | 104 | body.has-header-video.colors-custom .site-description { |
104 | - color: #<?php echo esc_attr( $header_text_color ); ?>; |
|
105 | + color: #<?php echo esc_attr( $header_text_color ); |
|
106 | + } |
|
107 | + ?>; |
|
105 | 108 | } |
106 | 109 | <?php endif; ?> |
107 | 110 | </style> |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | * @since Twenty Seventeen 1.0 |
20 | 20 | */ |
21 | 21 | function twentyseventeen_switch_theme() { |
22 | - switch_theme( WP_DEFAULT_THEME ); |
|
23 | - unset( $_GET['activated'] ); |
|
24 | - add_action( 'admin_notices', 'twentyseventeen_upgrade_notice' ); |
|
22 | + switch_theme(WP_DEFAULT_THEME); |
|
23 | + unset($_GET['activated']); |
|
24 | + add_action('admin_notices', 'twentyseventeen_upgrade_notice'); |
|
25 | 25 | } |
26 | -add_action( 'after_switch_theme', 'twentyseventeen_switch_theme' ); |
|
26 | +add_action('after_switch_theme', 'twentyseventeen_switch_theme'); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Adds a message for unsuccessful theme switch. |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * @global string $wp_version WordPress version. |
37 | 37 | */ |
38 | 38 | function twentyseventeen_upgrade_notice() { |
39 | - $message = sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ); |
|
40 | - printf( '<div class="error"><p>%s</p></div>', $message ); |
|
39 | + $message = sprintf(__('Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen'), $GLOBALS['wp_version']); |
|
40 | + printf('<div class="error"><p>%s</p></div>', $message); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | * @global string $wp_version WordPress version. |
49 | 49 | */ |
50 | 50 | function twentyseventeen_customize() { |
51 | - wp_die( sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ), '', array( |
|
51 | + wp_die(sprintf(__('Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen'), $GLOBALS['wp_version']), '', array( |
|
52 | 52 | 'back_link' => true, |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | } |
55 | -add_action( 'load-customize.php', 'twentyseventeen_customize' ); |
|
55 | +add_action('load-customize.php', 'twentyseventeen_customize'); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Prevents the Theme Preview from being loaded on WordPress versions prior to 4.7. |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @global string $wp_version WordPress version. |
63 | 63 | */ |
64 | 64 | function twentyseventeen_preview() { |
65 | - if ( isset( $_GET['preview'] ) ) { |
|
66 | - wp_die( sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ) ); |
|
65 | + if (isset($_GET['preview'])) { |
|
66 | + wp_die(sprintf(__('Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen'), $GLOBALS['wp_version'])); |
|
67 | 67 | } |
68 | 68 | } |
69 | -add_action( 'template_redirect', 'twentyseventeen_preview' ); |
|
69 | +add_action('template_redirect', 'twentyseventeen_preview'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! function_exists( 'twentyseventeen_posted_on' ) ) : |
|
12 | +if ( ! function_exists('twentyseventeen_posted_on')) : |
|
13 | 13 | /** |
14 | 14 | * Prints HTML with meta information for the current post-date/time and author. |
15 | 15 | */ |
@@ -18,74 +18,74 @@ discard block |
||
18 | 18 | // Get the author name; wrap it in a link. |
19 | 19 | $byline = sprintf( |
20 | 20 | /* translators: %s: post author */ |
21 | - __( 'by %s', 'twentyseventeen' ), |
|
22 | - '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author() . '</a></span>' |
|
21 | + __('by %s', 'twentyseventeen'), |
|
22 | + '<span class="author vcard"><a class="url fn n" href="'.esc_url(get_author_posts_url(get_the_author_meta('ID'))).'">'.get_the_author().'</a></span>' |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | // Finally, let's write all of this to the page. |
26 | - echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>'; |
|
26 | + echo '<span class="posted-on">'.twentyseventeen_time_link().'</span><span class="byline"> '.$byline.'</span>'; |
|
27 | 27 | } |
28 | 28 | endif; |
29 | 29 | |
30 | 30 | |
31 | -if ( ! function_exists( 'twentyseventeen_time_link' ) ) : |
|
31 | +if ( ! function_exists('twentyseventeen_time_link')) : |
|
32 | 32 | /** |
33 | 33 | * Gets a nicely formatted string for the published date. |
34 | 34 | */ |
35 | 35 | function twentyseventeen_time_link() { |
36 | 36 | $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; |
37 | - if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { |
|
37 | + if (get_the_time('U') !== get_the_modified_time('U')) { |
|
38 | 38 | $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; |
39 | 39 | } |
40 | 40 | |
41 | - $time_string = sprintf( $time_string, |
|
42 | - get_the_date( DATE_W3C ), |
|
41 | + $time_string = sprintf($time_string, |
|
42 | + get_the_date(DATE_W3C), |
|
43 | 43 | get_the_date(), |
44 | - get_the_modified_date( DATE_W3C ), |
|
44 | + get_the_modified_date(DATE_W3C), |
|
45 | 45 | get_the_modified_date() |
46 | 46 | ); |
47 | 47 | |
48 | 48 | // Wrap the time string in a link, and preface it with 'Posted on'. |
49 | 49 | return sprintf( |
50 | 50 | /* translators: %s: post date */ |
51 | - __( '<span class="screen-reader-text">Posted on</span> %s', 'twentyseventeen' ), |
|
52 | - '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' |
|
51 | + __('<span class="screen-reader-text">Posted on</span> %s', 'twentyseventeen'), |
|
52 | + '<a href="'.esc_url(get_permalink()).'" rel="bookmark">'.$time_string.'</a>' |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 | endif; |
56 | 56 | |
57 | 57 | |
58 | -if ( ! function_exists( 'twentyseventeen_entry_footer' ) ) : |
|
58 | +if ( ! function_exists('twentyseventeen_entry_footer')) : |
|
59 | 59 | /** |
60 | 60 | * Prints HTML with meta information for the categories, tags and comments. |
61 | 61 | */ |
62 | 62 | function twentyseventeen_entry_footer() { |
63 | 63 | |
64 | 64 | /* translators: used between list items, there is a space after the comma */ |
65 | - $separate_meta = __( ', ', 'twentyseventeen' ); |
|
65 | + $separate_meta = __(', ', 'twentyseventeen'); |
|
66 | 66 | |
67 | 67 | // Get Categories for posts. |
68 | - $categories_list = get_the_category_list( $separate_meta ); |
|
68 | + $categories_list = get_the_category_list($separate_meta); |
|
69 | 69 | |
70 | 70 | // Get Tags for posts. |
71 | - $tags_list = get_the_tag_list( '', $separate_meta ); |
|
71 | + $tags_list = get_the_tag_list('', $separate_meta); |
|
72 | 72 | |
73 | 73 | // We don't want to output .entry-footer if it will be empty, so make sure its not. |
74 | - if ( ( ( twentyseventeen_categorized_blog() && $categories_list ) || $tags_list ) || get_edit_post_link() ) { |
|
74 | + if (((twentyseventeen_categorized_blog() && $categories_list) || $tags_list) || get_edit_post_link()) { |
|
75 | 75 | |
76 | 76 | echo '<footer class="entry-footer">'; |
77 | 77 | |
78 | - if ( 'post' === get_post_type() ) { |
|
79 | - if ( ( $categories_list && twentyseventeen_categorized_blog() ) || $tags_list ) { |
|
78 | + if ('post' === get_post_type()) { |
|
79 | + if (($categories_list && twentyseventeen_categorized_blog()) || $tags_list) { |
|
80 | 80 | echo '<span class="cat-tags-links">'; |
81 | 81 | |
82 | 82 | // Make sure there's more than one category before displaying. |
83 | - if ( $categories_list && twentyseventeen_categorized_blog() ) { |
|
84 | - echo '<span class="cat-links">' . twentyseventeen_get_svg( array( 'icon' => 'folder-open' ) ) . '<span class="screen-reader-text">' . __( 'Categories', 'twentyseventeen' ) . '</span>' . $categories_list . '</span>'; |
|
83 | + if ($categories_list && twentyseventeen_categorized_blog()) { |
|
84 | + echo '<span class="cat-links">'.twentyseventeen_get_svg(array('icon' => 'folder-open')).'<span class="screen-reader-text">'.__('Categories', 'twentyseventeen').'</span>'.$categories_list.'</span>'; |
|
85 | 85 | } |
86 | 86 | |
87 | - if ( $tags_list ) { |
|
88 | - echo '<span class="tags-links">' . twentyseventeen_get_svg( array( 'icon' => 'hashtag' ) ) . '<span class="screen-reader-text">' . __( 'Tags', 'twentyseventeen' ) . '</span>' . $tags_list . '</span>'; |
|
87 | + if ($tags_list) { |
|
88 | + echo '<span class="tags-links">'.twentyseventeen_get_svg(array('icon' => 'hashtag')).'<span class="screen-reader-text">'.__('Tags', 'twentyseventeen').'</span>'.$tags_list.'</span>'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | echo '</span>'; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | endif; |
101 | 101 | |
102 | 102 | |
103 | -if ( ! function_exists( 'twentyseventeen_edit_link' ) ) : |
|
103 | +if ( ! function_exists('twentyseventeen_edit_link')) : |
|
104 | 104 | /** |
105 | 105 | * Returns an accessibility-friendly link to edit a post or page. |
106 | 106 | * |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $link = edit_post_link( |
115 | 115 | sprintf( |
116 | 116 | /* translators: %s: Name of current post */ |
117 | - __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), |
|
117 | + __('Edit<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen'), |
|
118 | 118 | get_the_title() |
119 | 119 | ), |
120 | 120 | '<span class="edit-link">', |
@@ -131,27 +131,27 @@ discard block |
||
131 | 131 | * @param WP_Customize_Partial $partial Partial associated with a selective refresh request. |
132 | 132 | * @param integer $id Front page section to display. |
133 | 133 | */ |
134 | -function twentyseventeen_front_page_section( $partial = null, $id = 0 ) { |
|
135 | - if ( is_a( $partial, 'WP_Customize_Partial' ) ) { |
|
134 | +function twentyseventeen_front_page_section($partial = null, $id = 0) { |
|
135 | + if (is_a($partial, 'WP_Customize_Partial')) { |
|
136 | 136 | // Find out the id and set it up during a selective refresh. |
137 | 137 | global $twentyseventeencounter; |
138 | - $id = str_replace( 'panel_', '', $partial->id ); |
|
138 | + $id = str_replace('panel_', '', $partial->id); |
|
139 | 139 | $twentyseventeencounter = $id; |
140 | 140 | } |
141 | 141 | |
142 | 142 | global $post; // Modify the global post object before setting up post data. |
143 | - if ( get_theme_mod( 'panel_' . $id ) ) { |
|
143 | + if (get_theme_mod('panel_'.$id)) { |
|
144 | 144 | global $post; |
145 | - $post = get_post( get_theme_mod( 'panel_' . $id ) ); |
|
146 | - setup_postdata( $post ); |
|
147 | - set_query_var( 'panel', $id ); |
|
145 | + $post = get_post(get_theme_mod('panel_'.$id)); |
|
146 | + setup_postdata($post); |
|
147 | + set_query_var('panel', $id); |
|
148 | 148 | |
149 | - get_template_part( 'template-parts/page/content', 'front-page-panels' ); |
|
149 | + get_template_part('template-parts/page/content', 'front-page-panels'); |
|
150 | 150 | |
151 | 151 | wp_reset_postdata(); |
152 | - } elseif ( is_customize_preview() ) { |
|
152 | + } elseif (is_customize_preview()) { |
|
153 | 153 | // The output placeholder anchor. |
154 | - echo '<article class="panel-placeholder panel twentyseventeen-panel twentyseventeen-panel' . $id . '" id="panel' . $id . '"><span class="twentyseventeen-panel-title">' . sprintf( __( 'Front Page Section %1$s Placeholder', 'twentyseventeen' ), $id ) . '</span></article>'; |
|
154 | + echo '<article class="panel-placeholder panel twentyseventeen-panel twentyseventeen-panel'.$id.'" id="panel'.$id.'"><span class="twentyseventeen-panel-title">'.sprintf(__('Front Page Section %1$s Placeholder', 'twentyseventeen'), $id).'</span></article>'; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -161,21 +161,21 @@ discard block |
||
161 | 161 | * @return bool |
162 | 162 | */ |
163 | 163 | function twentyseventeen_categorized_blog() { |
164 | - $category_count = get_transient( 'twentyseventeen_categories' ); |
|
164 | + $category_count = get_transient('twentyseventeen_categories'); |
|
165 | 165 | |
166 | - if ( false === $category_count ) { |
|
166 | + if (false === $category_count) { |
|
167 | 167 | // Create an array of all the categories that are attached to posts. |
168 | - $categories = get_categories( array( |
|
168 | + $categories = get_categories(array( |
|
169 | 169 | 'fields' => 'ids', |
170 | 170 | 'hide_empty' => 1, |
171 | 171 | // We only need to know if there is more than one category. |
172 | 172 | 'number' => 2, |
173 | - ) ); |
|
173 | + )); |
|
174 | 174 | |
175 | 175 | // Count the number of categories that are attached to the posts. |
176 | - $category_count = count( $categories ); |
|
176 | + $category_count = count($categories); |
|
177 | 177 | |
178 | - set_transient( 'twentyseventeen_categories', $category_count ); |
|
178 | + set_transient('twentyseventeen_categories', $category_count); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $category_count > 1; |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | * Flush out the transients used in twentyseventeen_categorized_blog. |
187 | 187 | */ |
188 | 188 | function twentyseventeen_category_transient_flusher() { |
189 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
189 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | // Like, beat it. Dig? |
193 | - delete_transient( 'twentyseventeen_categories' ); |
|
193 | + delete_transient('twentyseventeen_categories'); |
|
194 | 194 | } |
195 | -add_action( 'edit_category', 'twentyseventeen_category_transient_flusher' ); |
|
196 | -add_action( 'save_post', 'twentyseventeen_category_transient_flusher' ); |
|
195 | +add_action('edit_category', 'twentyseventeen_category_transient_flusher'); |
|
196 | +add_action('save_post', 'twentyseventeen_category_transient_flusher'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Generate the CSS for the current custom color scheme. |
12 | 12 | */ |
13 | 13 | function twentyseventeen_custom_colors_css() { |
14 | - $hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) ); |
|
14 | + $hue = absint(get_theme_mod('colorscheme_hue', 250)); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Filter Twenty Seventeen default saturation level. |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param $saturation integer |
22 | 22 | */ |
23 | - $saturation = absint( apply_filters( 'twentyseventeen_custom_colors_saturation', 50 ) ); |
|
24 | - $reduced_saturation = ( .8 * $saturation ) . '%'; |
|
25 | - $saturation = $saturation . '%'; |
|
23 | + $saturation = absint(apply_filters('twentyseventeen_custom_colors_saturation', 50)); |
|
24 | + $reduced_saturation = (.8 * $saturation).'%'; |
|
25 | + $saturation = $saturation.'%'; |
|
26 | 26 | $css = ' |
27 | 27 | /** |
28 | 28 | * Twenty Seventeen: Color Patterns |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | .colors-custom .widget .widget-title a:hover, |
87 | 87 | .colors-custom .widget ul li a:focus, |
88 | 88 | .colors-custom .widget ul li a:hover { |
89 | - color: hsl( ' . $hue . ', ' . $saturation . ', 0% ); /* base: #000; */ |
|
89 | + color: hsl( ' . $hue.', '.$saturation.', 0% ); /* base: #000; */ |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | .colors-custom .entry-content a, |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | .colors-custom .site-footer .widget-area a, |
96 | 96 | .colors-custom .posts-navigation a, |
97 | 97 | .colors-custom .widget_authors a strong { |
98 | - -webkit-box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation . ', 6% ); /* base: rgba(15, 15, 15, 1); */ |
|
99 | - box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation . ', 6% ); /* base: rgba(15, 15, 15, 1); */ |
|
98 | + -webkit-box-shadow: inset 0 -1px 0 hsl( ' . $hue.', '.$saturation.', 6% ); /* base: rgba(15, 15, 15, 1); */ |
|
99 | + box-shadow: inset 0 -1px 0 hsl( ' . $hue.', '.$saturation.', 6% ); /* base: rgba(15, 15, 15, 1); */ |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | .colors-custom button, |
103 | 103 | .colors-custom input[type="button"], |
104 | 104 | .colors-custom input[type="submit"], |
105 | 105 | .colors-custom .entry-footer .edit-link a.post-edit-link { |
106 | - background-color: hsl( ' . $hue . ', ' . $saturation . ', 13% ); /* base: #222; */ |
|
106 | + background-color: hsl( ' . $hue.', '.$saturation.', 13% ); /* base: #222; */ |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | .colors-custom input[type="text"]:focus, |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | .colors-custom .post-navigation a:hover .icon, |
146 | 146 | .colors-custom .site-content .site-content-light, |
147 | 147 | .colors-custom .twentyseventeen-panel .recent-posts .entry-header .edit-link { |
148 | - color: hsl( ' . $hue . ', ' . $saturation . ', 13% ); /* base: #222; */ |
|
148 | + color: hsl( ' . $hue.', '.$saturation.', 13% ); /* base: #222; */ |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | .colors-custom .entry-content a:focus, |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | .colors-custom .widget .widget-title a:hover, |
201 | 201 | .colors-custom .widget ul li a:focus, |
202 | 202 | .colors-custom .widget ul li a:hover { |
203 | - -webkit-box-shadow: inset 0 0 0 hsl( ' . $hue . ', ' . $saturation . ', 13% ), 0 3px 0 hsl( ' . $hue . ', ' . $saturation . ', 13% ); |
|
204 | - box-shadow: inset 0 0 0 hsl( ' . $hue . ', ' . $saturation . ' , 13% ), 0 3px 0 hsl( ' . $hue . ', ' . $saturation . ', 13% ); |
|
203 | + -webkit-box-shadow: inset 0 0 0 hsl( ' . $hue.', '.$saturation.', 13% ), 0 3px 0 hsl( '.$hue.', '.$saturation.', 13% ); |
|
204 | + box-shadow: inset 0 0 0 hsl( ' . $hue.', '.$saturation.' , 13% ), 0 3px 0 hsl( '.$hue.', '.$saturation.', 13% ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | body.colors-custom, |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | .colors-custom .nav-title, |
222 | 222 | .colors-custom .comment-body, |
223 | 223 | .colors-custom .site-content .wp-playlist-light .wp-playlist-current-item .wp-playlist-item-album { |
224 | - color: hsl( ' . $hue . ', ' . $reduced_saturation . ', 20% ); /* base: #333; */ |
|
224 | + color: hsl( ' . $hue.', '.$reduced_saturation.', 20% ); /* base: #333; */ |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | .colors-custom .social-navigation a:hover, |
228 | 228 | .colors-custom .social-navigation a:focus { |
229 | - background: hsl( ' . $hue . ', ' . $reduced_saturation . ', 20% ); /* base: #333; */ |
|
229 | + background: hsl( ' . $hue.', '.$reduced_saturation.', 20% ); /* base: #333; */ |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | .colors-custom input[type="text"]:focus, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | .colors-custom input[type="color"]:focus, |
247 | 247 | .colors-custom textarea:focus, |
248 | 248 | .bypostauthor > .comment-body > .comment-meta > .comment-author .avatar { |
249 | - border-color: hsl( ' . $hue . ', ' . $reduced_saturation . ', 20% ); /* base: #333; */ |
|
249 | + border-color: hsl( ' . $hue.', '.$reduced_saturation.', 20% ); /* base: #333; */ |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | .colors-custom h2, |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | .colors-custom .site-info a, |
275 | 275 | .colors-custom .wp-caption, |
276 | 276 | .colors-custom .gallery-caption { |
277 | - color: hsl( ' . $hue . ', ' . $saturation . ', 40% ); /* base: #666; */ |
|
277 | + color: hsl( ' . $hue.', '.$saturation.', 40% ); /* base: #666; */ |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | .colors-custom abbr, |
281 | 281 | .colors-custom acronym { |
282 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 40% ); /* base: #666; */ |
|
282 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 40% ); /* base: #666; */ |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | .colors-custom h5, |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | .colors-custom .navigation-top .current_page_item > a, |
300 | 300 | .colors-custom .main-navigation a:hover, |
301 | 301 | .colors-custom .site-content .wp-playlist-light .wp-playlist-current-item .wp-playlist-item-artist { |
302 | - color: hsl( ' . $hue . ', ' . $saturation . ', 46% ); /* base: #767676; */ |
|
302 | + color: hsl( ' . $hue.', '.$saturation.', 46% ); /* base: #767676; */ |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | .colors-custom button:hover, |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | .colors-custom .next.page-numbers:hover, |
318 | 318 | .colors-custom .site-content .wp-playlist-light .wp-playlist-item:hover, |
319 | 319 | .colors-custom .site-content .wp-playlist-light .wp-playlist-item:focus { |
320 | - background: hsl( ' . esc_attr( $hue ) . ', ' . esc_attr( $saturation ) . ', 46% ); /* base: #767676; */ |
|
320 | + background: hsl( ' . esc_attr($hue).', '.esc_attr($saturation).', 46% ); /* base: #767676; */ |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | .colors-custom button.secondary:hover, |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | .colors-custom input[type="submit"].secondary:hover, |
332 | 332 | .colors-custom input[type="submit"].secondary:focus, |
333 | 333 | .colors-custom hr { |
334 | - background: hsl( ' . $hue . ', ' . $saturation . ', 73% ); /* base: #bbb; */ |
|
334 | + background: hsl( ' . $hue.', '.$saturation.', 73% ); /* base: #bbb; */ |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | .colors-custom input[type="text"], |
@@ -358,16 +358,16 @@ discard block |
||
358 | 358 | .colors-custom .widget.widget_tag_cloud a:focus, |
359 | 359 | .colors-custom .wp_widget_tag_cloud a:hover, |
360 | 360 | .colors-custom .wp_widget_tag_cloud a:focus { |
361 | - border-color: hsl( ' . $hue . ', ' . $saturation . ', 73% ); /* base: #bbb; */ |
|
361 | + border-color: hsl( ' . $hue.', '.$saturation.', 73% ); /* base: #bbb; */ |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | .colors-custom thead th { |
365 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 73% ); /* base: #bbb; */ |
|
365 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 73% ); /* base: #bbb; */ |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | .colors-custom .entry-footer .cat-links .icon, |
369 | 369 | .colors-custom .entry-footer .tags-links .icon { |
370 | - color: hsl( ' . $hue . ', ' . $saturation . ', 73% ); /* base: #bbb; */ |
|
370 | + color: hsl( ' . $hue.', '.$saturation.', 73% ); /* base: #bbb; */ |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | .colors-custom button.secondary, |
@@ -377,28 +377,28 @@ discard block |
||
377 | 377 | .colors-custom input[type="submit"].secondary, |
378 | 378 | .colors-custom .prev.page-numbers, |
379 | 379 | .colors-custom .next.page-numbers { |
380 | - background-color: hsl( ' . $hue . ', ' . $saturation . ', 87% ); /* base: #ddd; */ |
|
380 | + background-color: hsl( ' . $hue.', '.$saturation.', 87% ); /* base: #ddd; */ |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | .colors-custom .widget .tagcloud a, |
384 | 384 | .colors-custom .widget.widget_tag_cloud a, |
385 | 385 | .colors-custom .wp_widget_tag_cloud a { |
386 | - border-color: hsl( ' . $hue . ', ' . $saturation . ', 87% ); /* base: #ddd; */ |
|
386 | + border-color: hsl( ' . $hue.', '.$saturation.', 87% ); /* base: #ddd; */ |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | .colors-custom.twentyseventeen-front-page article:not(.has-post-thumbnail):not(:first-child), |
390 | 390 | .colors-custom .widget ul li { |
391 | - border-top-color: hsl( ' . $hue . ', ' . $saturation . ', 87% ); /* base: #ddd; */ |
|
391 | + border-top-color: hsl( ' . $hue.', '.$saturation.', 87% ); /* base: #ddd; */ |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | .colors-custom .widget ul li { |
395 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 87% ); /* base: #ddd; */ |
|
395 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 87% ); /* base: #ddd; */ |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | .colors-custom pre, |
399 | 399 | .colors-custom mark, |
400 | 400 | .colors-custom ins { |
401 | - background: hsl( ' . $hue . ', ' . $saturation . ', 93% ); /* base: #eee; */ |
|
401 | + background: hsl( ' . $hue.', '.$saturation.', 93% ); /* base: #eee; */ |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | .colors-custom .navigation-top, |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | .colors-custom .comments-pagination, |
408 | 408 | .colors-custom .entry-footer, |
409 | 409 | .colors-custom .site-footer { |
410 | - border-top-color: hsl( ' . $hue . ', ' . $saturation . ', 93% ); /* base: #eee; */ |
|
410 | + border-top-color: hsl( ' . $hue.', '.$saturation.', 93% ); /* base: #eee; */ |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | .colors-custom .navigation-top, |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | .colors-custom .single-featured-image-header, |
417 | 417 | .colors-custom .site-content .wp-playlist-light .wp-playlist-item, |
418 | 418 | .colors-custom tr { |
419 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 93% ); /* base: #eee; */ |
|
419 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 93% ); /* base: #eee; */ |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | .colors-custom .site-content .wp-playlist-light { |
423 | - border-color: hsl( ' . $hue . ', ' . $saturation . ', 93% ); /* base: #eee; */ |
|
423 | + border-color: hsl( ' . $hue.', '.$saturation.', 93% ); /* base: #eee; */ |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | .colors-custom .site-header, |
427 | 427 | .colors-custom .single-featured-image-header { |
428 | - background-color: hsl( ' . $hue . ', ' . $saturation . ', 98% ); /* base: #fafafa; */ |
|
428 | + background-color: hsl( ' . $hue.', '.$saturation.', 98% ); /* base: #fafafa; */ |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | .colors-custom button, |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | .colors-custom.has-header-video .site-title a, |
449 | 449 | .colors-custom.has-header-image .site-description, |
450 | 450 | .colors-custom.has-header-video .site-description { |
451 | - color: hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: #fff; */ |
|
451 | + color: hsl( ' . $hue.', '.$saturation.', 100% ); /* base: #fff; */ |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | body.colors-custom, |
455 | 455 | .colors-custom .navigation-top, |
456 | 456 | .colors-custom .main-navigation ul { |
457 | - background: hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: #fff; */ |
|
457 | + background: hsl( ' . $hue.', '.$saturation.', 100% ); /* base: #fff; */ |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | .colors-custom .widget ul li a, |
461 | 461 | .colors-custom .site-footer .widget-area ul li a { |
462 | - -webkit-box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: rgba(255, 255, 255, 1); */ |
|
463 | - box-shadow: inset 0 -1px 0 hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: rgba(255, 255, 255, 1); */ |
|
462 | + -webkit-box-shadow: inset 0 -1px 0 hsl( ' . $hue.', '.$saturation.', 100% ); /* base: rgba(255, 255, 255, 1); */ |
|
463 | + box-shadow: inset 0 -1px 0 hsl( ' . $hue.', '.$saturation.', 100% ); /* base: rgba(255, 255, 255, 1); */ |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | .colors-custom .menu-toggle, |
@@ -516,35 +516,35 @@ discard block |
||
516 | 516 | |
517 | 517 | .colors-custom .nav-links .nav-previous .nav-title .icon, |
518 | 518 | .colors-custom .nav-links .nav-next .nav-title .icon { |
519 | - color: hsl( ' . $hue . ', ' . $saturation . ', 20% ); /* base: #222; */ |
|
519 | + color: hsl( ' . $hue.', '.$saturation.', 20% ); /* base: #222; */ |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | .colors-custom .main-navigation li li:hover, |
523 | 523 | .colors-custom .main-navigation li li.focus { |
524 | - background: hsl( ' . $hue . ', ' . $saturation . ', 46% ); /* base: #767676; */ |
|
524 | + background: hsl( ' . $hue.', '.$saturation.', 46% ); /* base: #767676; */ |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | .colors-custom .navigation-top .menu-scroll-down { |
528 | - color: hsl( ' . $hue . ', ' . $saturation . ', 46% ); /* base: #767676; */; |
|
528 | + color: hsl( ' . $hue.', '.$saturation.', 46% ); /* base: #767676; */; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | .colors-custom abbr[title] { |
532 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 46% ); /* base: #767676; */; |
|
532 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 46% ); /* base: #767676; */; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | .colors-custom .main-navigation ul ul { |
536 | - border-color: hsl( ' . $hue . ', ' . $saturation . ', 73% ); /* base: #bbb; */ |
|
537 | - background: hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: #fff; */ |
|
536 | + border-color: hsl( ' . $hue.', '.$saturation.', 73% ); /* base: #bbb; */ |
|
537 | + background: hsl( ' . $hue.', '.$saturation.', 100% ); /* base: #fff; */ |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | .colors-custom .main-navigation ul li.menu-item-has-children:before, |
541 | 541 | .colors-custom .main-navigation ul li.page_item_has_children:before { |
542 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 73% ); /* base: #bbb; */ |
|
542 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 73% ); /* base: #bbb; */ |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | .colors-custom .main-navigation ul li.menu-item-has-children:after, |
546 | 546 | .colors-custom .main-navigation ul li.page_item_has_children:after { |
547 | - border-bottom-color: hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: #fff; */ |
|
547 | + border-bottom-color: hsl( ' . $hue.', '.$saturation.', 100% ); /* base: #fff; */ |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | .colors-custom .main-navigation li li.focus > a, |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | .colors-custom .main-navigation li li.current-menu-item a:hover, |
557 | 557 | .colors-custom .main-navigation li li.current_page_item a:focus, |
558 | 558 | .colors-custom .main-navigation li li.current-menu-item a:focus { |
559 | - color: hsl( ' . $hue . ', ' . $saturation . ', 100% ); /* base: #fff; */ |
|
559 | + color: hsl( ' . $hue.', '.$saturation.', 100% ); /* base: #fff; */ |
|
560 | 560 | } |
561 | 561 | }'; |
562 | 562 | |
@@ -569,5 +569,5 @@ discard block |
||
569 | 569 | * @param $hue int The user's selected color hue. |
570 | 570 | * @param $saturation string Filtered theme color saturation level. |
571 | 571 | */ |
572 | - return apply_filters( 'twentyseventeen_custom_colors_css', $css, $hue, $saturation ); |
|
572 | + return apply_filters('twentyseventeen_custom_colors_css', $css, $hue, $saturation); |
|
573 | 573 | } |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | */ |
13 | 13 | function twentyseventeen_include_svg_icons() { |
14 | 14 | // Define SVG sprite file. |
15 | - $svg_icons = get_parent_theme_file_path( '/assets/images/svg-icons.svg' ); |
|
15 | + $svg_icons = get_parent_theme_file_path('/assets/images/svg-icons.svg'); |
|
16 | 16 | |
17 | 17 | // If it exists, include it. |
18 | - if ( file_exists( $svg_icons ) ) { |
|
19 | - require_once( $svg_icons ); |
|
18 | + if (file_exists($svg_icons)) { |
|
19 | + require_once($svg_icons); |
|
20 | 20 | } |
21 | 21 | } |
22 | -add_action( 'wp_footer', 'twentyseventeen_include_svg_icons', 9999 ); |
|
22 | +add_action('wp_footer', 'twentyseventeen_include_svg_icons', 9999); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Return SVG markup. |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * } |
34 | 34 | * @return string SVG markup. |
35 | 35 | */ |
36 | -function twentyseventeen_get_svg( $args = array() ) { |
|
36 | +function twentyseventeen_get_svg($args = array()) { |
|
37 | 37 | // Make sure $args are an array. |
38 | - if ( empty( $args ) ) { |
|
39 | - return __( 'Please define default parameters in the form of an array.', 'twentyseventeen' ); |
|
38 | + if (empty($args)) { |
|
39 | + return __('Please define default parameters in the form of an array.', 'twentyseventeen'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Define an icon. |
43 | - if ( false === array_key_exists( 'icon', $args ) ) { |
|
44 | - return __( 'Please define an SVG icon filename.', 'twentyseventeen' ); |
|
43 | + if (false === array_key_exists('icon', $args)) { |
|
44 | + return __('Please define an SVG icon filename.', 'twentyseventeen'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set defaults. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Parse args. |
56 | - $args = wp_parse_args( $args, $defaults ); |
|
56 | + $args = wp_parse_args($args, $defaults); |
|
57 | 57 | |
58 | 58 | // Set aria hidden. |
59 | 59 | $aria_hidden = ' aria-hidden="true"'; |
@@ -72,26 +72,26 @@ discard block |
||
72 | 72 | * |
73 | 73 | * See https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/. |
74 | 74 | */ |
75 | - if ( $args['title'] ) { |
|
75 | + if ($args['title']) { |
|
76 | 76 | $aria_hidden = ''; |
77 | 77 | $unique_id = uniqid(); |
78 | - $aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"'; |
|
78 | + $aria_labelledby = ' aria-labelledby="title-'.$unique_id.'"'; |
|
79 | 79 | |
80 | - if ( $args['desc'] ) { |
|
81 | - $aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"'; |
|
80 | + if ($args['desc']) { |
|
81 | + $aria_labelledby = ' aria-labelledby="title-'.$unique_id.' desc-'.$unique_id.'"'; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Begin SVG markup. |
86 | - $svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . $aria_labelledby . ' role="img">'; |
|
86 | + $svg = '<svg class="icon icon-'.esc_attr($args['icon']).'"'.$aria_hidden.$aria_labelledby.' role="img">'; |
|
87 | 87 | |
88 | 88 | // Display the title. |
89 | - if ( $args['title'] ) { |
|
90 | - $svg .= '<title id="title-' . $unique_id . '">' . esc_html( $args['title'] ) . '</title>'; |
|
89 | + if ($args['title']) { |
|
90 | + $svg .= '<title id="title-'.$unique_id.'">'.esc_html($args['title']).'</title>'; |
|
91 | 91 | |
92 | 92 | // Display the desc only if the title is already set. |
93 | - if ( $args['desc'] ) { |
|
94 | - $svg .= '<desc id="desc-' . $unique_id . '">' . esc_html( $args['desc'] ) . '</desc>'; |
|
93 | + if ($args['desc']) { |
|
94 | + $svg .= '<desc id="desc-'.$unique_id.'">'.esc_html($args['desc']).'</desc>'; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | * |
103 | 103 | * See https://core.trac.wordpress.org/ticket/38387. |
104 | 104 | */ |
105 | - $svg .= ' <use href="#icon-' . esc_html( $args['icon'] ) . '" xlink:href="#icon-' . esc_html( $args['icon'] ) . '"></use> '; |
|
105 | + $svg .= ' <use href="#icon-'.esc_html($args['icon']).'" xlink:href="#icon-'.esc_html($args['icon']).'"></use> '; |
|
106 | 106 | |
107 | 107 | // Add some markup to use as a fallback for browsers that do not support SVGs. |
108 | - if ( $args['fallback'] ) { |
|
109 | - $svg .= '<span class="svg-fallback icon-' . esc_attr( $args['icon'] ) . '"></span>'; |
|
108 | + if ($args['fallback']) { |
|
109 | + $svg .= '<span class="svg-fallback icon-'.esc_attr($args['icon']).'"></span>'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $svg .= '</svg>'; |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | * @param array $args wp_nav_menu() arguments. |
124 | 124 | * @return string $item_output The menu item output with social icon. |
125 | 125 | */ |
126 | -function twentyseventeen_nav_menu_social_icons( $item_output, $item, $depth, $args ) { |
|
126 | +function twentyseventeen_nav_menu_social_icons($item_output, $item, $depth, $args) { |
|
127 | 127 | // Get supported social icons. |
128 | 128 | $social_icons = twentyseventeen_social_links_icons(); |
129 | 129 | |
130 | 130 | // Change SVG icon inside social links menu if there is supported URL. |
131 | - if ( 'social' === $args->theme_location ) { |
|
132 | - foreach ( $social_icons as $attr => $value ) { |
|
133 | - if ( false !== strpos( $item_output, $attr ) ) { |
|
134 | - $item_output = str_replace( $args->link_after, '</span>' . twentyseventeen_get_svg( array( 'icon' => esc_attr( $value ) ) ), $item_output ); |
|
131 | + if ('social' === $args->theme_location) { |
|
132 | + foreach ($social_icons as $attr => $value) { |
|
133 | + if (false !== strpos($item_output, $attr)) { |
|
134 | + $item_output = str_replace($args->link_after, '</span>'.twentyseventeen_get_svg(array('icon' => esc_attr($value))), $item_output); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | return $item_output; |
140 | 140 | } |
141 | -add_filter( 'walker_nav_menu_start_el', 'twentyseventeen_nav_menu_social_icons', 10, 4 ); |
|
141 | +add_filter('walker_nav_menu_start_el', 'twentyseventeen_nav_menu_social_icons', 10, 4); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Add dropdown icon if menu item has children. |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | * @param int $depth Depth of menu item. Used for padding. |
150 | 150 | * @return string $title The menu item's title with dropdown icon. |
151 | 151 | */ |
152 | -function twentyseventeen_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) { |
|
153 | - if ( 'top' === $args->theme_location ) { |
|
154 | - foreach ( $item->classes as $value ) { |
|
155 | - if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) { |
|
156 | - $title = $title . twentyseventeen_get_svg( array( 'icon' => 'angle-down' ) ); |
|
152 | +function twentyseventeen_dropdown_icon_to_menu_link($title, $item, $args, $depth) { |
|
153 | + if ('top' === $args->theme_location) { |
|
154 | + foreach ($item->classes as $value) { |
|
155 | + if ('menu-item-has-children' === $value || 'page_item_has_children' === $value) { |
|
156 | + $title = $title.twentyseventeen_get_svg(array('icon' => 'angle-down')); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | 161 | return $title; |
162 | 162 | } |
163 | -add_filter( 'nav_menu_item_title', 'twentyseventeen_dropdown_icon_to_menu_link', 10, 4 ); |
|
163 | +add_filter('nav_menu_item_title', 'twentyseventeen_dropdown_icon_to_menu_link', 10, 4); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Returns an array of supported social links (URL and icon name). |
@@ -214,5 +214,5 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @param array $social_links_icons |
216 | 216 | */ |
217 | - return apply_filters( 'twentyseventeen_social_links_icons', $social_links_icons ); |
|
217 | + return apply_filters('twentyseventeen_social_links_icons', $social_links_icons); |
|
218 | 218 | } |
@@ -12,78 +12,78 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
14 | 14 | */ |
15 | -function twentyseventeen_customize_register( $wp_customize ) { |
|
16 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
17 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
18 | - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
|
15 | +function twentyseventeen_customize_register($wp_customize) { |
|
16 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
17 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
18 | + $wp_customize->get_setting('header_textcolor')->transport = 'postMessage'; |
|
19 | 19 | |
20 | - $wp_customize->selective_refresh->add_partial( 'blogname', array( |
|
20 | + $wp_customize->selective_refresh->add_partial('blogname', array( |
|
21 | 21 | 'selector' => '.site-title a', |
22 | 22 | 'render_callback' => 'twentyseventeen_customize_partial_blogname', |
23 | - ) ); |
|
24 | - $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
|
23 | + )); |
|
24 | + $wp_customize->selective_refresh->add_partial('blogdescription', array( |
|
25 | 25 | 'selector' => '.site-description', |
26 | 26 | 'render_callback' => 'twentyseventeen_customize_partial_blogdescription', |
27 | - ) ); |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Custom colors. |
31 | 31 | */ |
32 | - $wp_customize->add_setting( 'colorscheme', array( |
|
32 | + $wp_customize->add_setting('colorscheme', array( |
|
33 | 33 | 'default' => 'light', |
34 | 34 | 'transport' => 'postMessage', |
35 | 35 | 'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - $wp_customize->add_setting( 'colorscheme_hue', array( |
|
38 | + $wp_customize->add_setting('colorscheme_hue', array( |
|
39 | 39 | 'default' => 250, |
40 | 40 | 'transport' => 'postMessage', |
41 | 41 | 'sanitize_callback' => 'absint', // The hue is stored as a positive integer. |
42 | - ) ); |
|
42 | + )); |
|
43 | 43 | |
44 | - $wp_customize->add_control( 'colorscheme', array( |
|
44 | + $wp_customize->add_control('colorscheme', array( |
|
45 | 45 | 'type' => 'radio', |
46 | - 'label' => __( 'Color Scheme', 'twentyseventeen' ), |
|
46 | + 'label' => __('Color Scheme', 'twentyseventeen'), |
|
47 | 47 | 'choices' => array( |
48 | - 'light' => __( 'Light', 'twentyseventeen' ), |
|
49 | - 'dark' => __( 'Dark', 'twentyseventeen' ), |
|
50 | - 'custom' => __( 'Custom', 'twentyseventeen' ), |
|
48 | + 'light' => __('Light', 'twentyseventeen'), |
|
49 | + 'dark' => __('Dark', 'twentyseventeen'), |
|
50 | + 'custom' => __('Custom', 'twentyseventeen'), |
|
51 | 51 | ), |
52 | 52 | 'section' => 'colors', |
53 | 53 | 'priority' => 5, |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | |
56 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'colorscheme_hue', array( |
|
56 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'colorscheme_hue', array( |
|
57 | 57 | 'mode' => 'hue', |
58 | 58 | 'section' => 'colors', |
59 | 59 | 'priority' => 6, |
60 | - ) ) ); |
|
60 | + ))); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Theme options. |
64 | 64 | */ |
65 | - $wp_customize->add_section( 'theme_options', array( |
|
66 | - 'title' => __( 'Theme Options', 'twentyseventeen' ), |
|
65 | + $wp_customize->add_section('theme_options', array( |
|
66 | + 'title' => __('Theme Options', 'twentyseventeen'), |
|
67 | 67 | 'priority' => 130, // Before Additional CSS. |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | - $wp_customize->add_setting( 'page_layout', array( |
|
70 | + $wp_customize->add_setting('page_layout', array( |
|
71 | 71 | 'default' => 'two-column', |
72 | 72 | 'sanitize_callback' => 'twentyseventeen_sanitize_page_layout', |
73 | 73 | 'transport' => 'postMessage', |
74 | - ) ); |
|
74 | + )); |
|
75 | 75 | |
76 | - $wp_customize->add_control( 'page_layout', array( |
|
77 | - 'label' => __( 'Page Layout', 'twentyseventeen' ), |
|
76 | + $wp_customize->add_control('page_layout', array( |
|
77 | + 'label' => __('Page Layout', 'twentyseventeen'), |
|
78 | 78 | 'section' => 'theme_options', |
79 | 79 | 'type' => 'radio', |
80 | - 'description' => __( 'When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen' ), |
|
80 | + 'description' => __('When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen'), |
|
81 | 81 | 'choices' => array( |
82 | - 'one-column' => __( 'One Column', 'twentyseventeen' ), |
|
83 | - 'two-column' => __( 'Two Column', 'twentyseventeen' ), |
|
82 | + 'one-column' => __('One Column', 'twentyseventeen'), |
|
83 | + 'two-column' => __('Two Column', 'twentyseventeen'), |
|
84 | 84 | ), |
85 | 85 | 'active_callback' => 'twentyseventeen_is_view_with_layout_option', |
86 | - ) ); |
|
86 | + )); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Filter number of front page sections in Twenty Seventeen. |
@@ -92,47 +92,47 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param $num_sections integer |
94 | 94 | */ |
95 | - $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); |
|
95 | + $num_sections = apply_filters('twentyseventeen_front_page_sections', 4); |
|
96 | 96 | |
97 | 97 | // Create a setting and control for each of the sections available in the theme. |
98 | - for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { |
|
99 | - $wp_customize->add_setting( 'panel_' . $i, array( |
|
98 | + for ($i = 1; $i < (1 + $num_sections); $i++) { |
|
99 | + $wp_customize->add_setting('panel_'.$i, array( |
|
100 | 100 | 'default' => false, |
101 | 101 | 'sanitize_callback' => 'absint', |
102 | 102 | 'transport' => 'postMessage', |
103 | - ) ); |
|
103 | + )); |
|
104 | 104 | |
105 | - $wp_customize->add_control( 'panel_' . $i, array( |
|
105 | + $wp_customize->add_control('panel_'.$i, array( |
|
106 | 106 | /* translators: %d is the front page section number */ |
107 | - 'label' => sprintf( __( 'Front Page Section %d Content', 'twentyseventeen' ), $i ), |
|
108 | - 'description' => ( 1 !== $i ? '' : __( 'Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen' ) ), |
|
107 | + 'label' => sprintf(__('Front Page Section %d Content', 'twentyseventeen'), $i), |
|
108 | + 'description' => (1 !== $i ? '' : __('Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen')), |
|
109 | 109 | 'section' => 'theme_options', |
110 | 110 | 'type' => 'dropdown-pages', |
111 | 111 | 'allow_addition' => true, |
112 | 112 | 'active_callback' => 'twentyseventeen_is_static_front_page', |
113 | - ) ); |
|
113 | + )); |
|
114 | 114 | |
115 | - $wp_customize->selective_refresh->add_partial( 'panel_' . $i, array( |
|
116 | - 'selector' => '#panel' . $i, |
|
115 | + $wp_customize->selective_refresh->add_partial('panel_'.$i, array( |
|
116 | + 'selector' => '#panel'.$i, |
|
117 | 117 | 'render_callback' => 'twentyseventeen_front_page_section', |
118 | 118 | 'container_inclusive' => true, |
119 | - ) ); |
|
119 | + )); |
|
120 | 120 | } |
121 | 121 | } |
122 | -add_action( 'customize_register', 'twentyseventeen_customize_register' ); |
|
122 | +add_action('customize_register', 'twentyseventeen_customize_register'); |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Sanitize the page layout options. |
126 | 126 | * |
127 | 127 | * @param string $input Page layout. |
128 | 128 | */ |
129 | -function twentyseventeen_sanitize_page_layout( $input ) { |
|
129 | +function twentyseventeen_sanitize_page_layout($input) { |
|
130 | 130 | $valid = array( |
131 | - 'one-column' => __( 'One Column', 'twentyseventeen' ), |
|
132 | - 'two-column' => __( 'Two Column', 'twentyseventeen' ), |
|
131 | + 'one-column' => __('One Column', 'twentyseventeen'), |
|
132 | + 'two-column' => __('Two Column', 'twentyseventeen'), |
|
133 | 133 | ); |
134 | 134 | |
135 | - if ( array_key_exists( $input, $valid ) ) { |
|
135 | + if (array_key_exists($input, $valid)) { |
|
136 | 136 | return $input; |
137 | 137 | } |
138 | 138 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param string $input Color scheme. |
146 | 146 | */ |
147 | -function twentyseventeen_sanitize_colorscheme( $input ) { |
|
148 | - $valid = array( 'light', 'dark', 'custom' ); |
|
147 | +function twentyseventeen_sanitize_colorscheme($input) { |
|
148 | + $valid = array('light', 'dark', 'custom'); |
|
149 | 149 | |
150 | - if ( in_array( $input, $valid, true ) ) { |
|
150 | + if (in_array($input, $valid, true)) { |
|
151 | 151 | return $input; |
152 | 152 | } |
153 | 153 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @return void |
164 | 164 | */ |
165 | 165 | function twentyseventeen_customize_partial_blogname() { |
166 | - bloginfo( 'name' ); |
|
166 | + bloginfo('name'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | * @return void |
176 | 176 | */ |
177 | 177 | function twentyseventeen_customize_partial_blogdescription() { |
178 | - bloginfo( 'description' ); |
|
178 | + bloginfo('description'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Return whether we're previewing the front page and it's a static page. |
183 | 183 | */ |
184 | 184 | function twentyseventeen_is_static_front_page() { |
185 | - return ( is_front_page() && ! is_home() ); |
|
185 | + return (is_front_page() && ! is_home()); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -190,21 +190,21 @@ discard block |
||
190 | 190 | */ |
191 | 191 | function twentyseventeen_is_view_with_layout_option() { |
192 | 192 | // This option is available on all pages. It's also available on archives when there isn't a sidebar. |
193 | - return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) ); |
|
193 | + return (is_page() || (is_archive() && ! is_active_sidebar('sidebar-1'))); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Bind JS handlers to instantly live-preview changes. |
198 | 198 | */ |
199 | 199 | function twentyseventeen_customize_preview_js() { |
200 | - wp_enqueue_script( 'twentyseventeen-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview' ), '1.0', true ); |
|
200 | + wp_enqueue_script('twentyseventeen-customize-preview', get_theme_file_uri('/assets/js/customize-preview.js'), array('customize-preview'), '1.0', true); |
|
201 | 201 | } |
202 | -add_action( 'customize_preview_init', 'twentyseventeen_customize_preview_js' ); |
|
202 | +add_action('customize_preview_init', 'twentyseventeen_customize_preview_js'); |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Load dynamic logic for the customizer controls area. |
206 | 206 | */ |
207 | 207 | function twentyseventeen_panels_js() { |
208 | - wp_enqueue_script( 'twentyseventeen-customize-controls', get_theme_file_uri( '/assets/js/customize-controls.js' ), array(), '1.0', true ); |
|
208 | + wp_enqueue_script('twentyseventeen-customize-controls', get_theme_file_uri('/assets/js/customize-controls.js'), array(), '1.0', true); |
|
209 | 209 | } |
210 | -add_action( 'customize_controls_enqueue_scripts', 'twentyseventeen_panels_js' ); |
|
210 | +add_action('customize_controls_enqueue_scripts', 'twentyseventeen_panels_js'); |