@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Custom Header functionality for Twenty Fifteen |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Twenty_Fifteen |
|
7 | - * @since Twenty Fifteen 1.0 |
|
8 | - */ |
|
3 | + * Custom Header functionality for Twenty Fifteen |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Twenty_Fifteen |
|
7 | + * @since Twenty Fifteen 1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Set up the WordPress core custom header feature. |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function twentyfifteen_custom_header_setup() { |
16 | 16 | $color_scheme = twentyfifteen_get_color_scheme(); |
17 | - $default_text_color = trim( $color_scheme[4], '#' ); |
|
17 | + $default_text_color = trim($color_scheme[4], '#'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Filter Twenty Fifteen custom-header support arguments. |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | * displayed on the blog. |
32 | 32 | * } |
33 | 33 | */ |
34 | - add_theme_support( 'custom-header', apply_filters( 'twentyfifteen_custom_header_args', array( |
|
34 | + add_theme_support('custom-header', apply_filters('twentyfifteen_custom_header_args', array( |
|
35 | 35 | 'default-text-color' => $default_text_color, |
36 | 36 | 'width' => 954, |
37 | 37 | 'height' => 1300, |
38 | 38 | 'wp-head-callback' => 'twentyfifteen_header_style', |
39 | - ) ) ); |
|
39 | + ))); |
|
40 | 40 | } |
41 | -add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' ); |
|
41 | +add_action('after_setup_theme', 'twentyfifteen_custom_header_setup'); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Convert HEX to RGB. |
@@ -49,25 +49,25 @@ discard block |
||
49 | 49 | * @return array Array containing RGB (red, green, and blue) values for the given |
50 | 50 | * HEX code, empty array otherwise. |
51 | 51 | */ |
52 | -function twentyfifteen_hex2rgb( $color ) { |
|
53 | - $color = trim( $color, '#' ); |
|
54 | - |
|
55 | - if ( strlen( $color ) == 3 ) { |
|
56 | - $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) ); |
|
57 | - $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) ); |
|
58 | - $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) ); |
|
59 | - } else if ( strlen( $color ) == 6 ) { |
|
60 | - $r = hexdec( substr( $color, 0, 2 ) ); |
|
61 | - $g = hexdec( substr( $color, 2, 2 ) ); |
|
62 | - $b = hexdec( substr( $color, 4, 2 ) ); |
|
52 | +function twentyfifteen_hex2rgb($color) { |
|
53 | + $color = trim($color, '#'); |
|
54 | + |
|
55 | + if (strlen($color) == 3) { |
|
56 | + $r = hexdec(substr($color, 0, 1).substr($color, 0, 1)); |
|
57 | + $g = hexdec(substr($color, 1, 1).substr($color, 1, 1)); |
|
58 | + $b = hexdec(substr($color, 2, 1).substr($color, 2, 1)); |
|
59 | + } else if (strlen($color) == 6) { |
|
60 | + $r = hexdec(substr($color, 0, 2)); |
|
61 | + $g = hexdec(substr($color, 2, 2)); |
|
62 | + $b = hexdec(substr($color, 4, 2)); |
|
63 | 63 | } else { |
64 | 64 | return array(); |
65 | 65 | } |
66 | 66 | |
67 | - return array( 'red' => $r, 'green' => $g, 'blue' => $b ); |
|
67 | + return array('red' => $r, 'green' => $g, 'blue' => $b); |
|
68 | 68 | } |
69 | 69 | |
70 | -if ( ! function_exists( 'twentyfifteen_header_style' ) ) : |
|
70 | +if ( ! function_exists('twentyfifteen_header_style')) : |
|
71 | 71 | /** |
72 | 72 | * Styles the header image and text displayed on the blog. |
73 | 73 | * |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $header_image = get_header_image(); |
80 | 80 | |
81 | 81 | // If no custom options for text are set, let's bail. |
82 | - if ( empty( $header_image ) && display_header_text() ) { |
|
82 | + if (empty($header_image) && display_header_text()) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | <style type="text/css" id="twentyfifteen-header-css"> |
89 | 89 | <?php |
90 | 90 | // Short header for when there is no Custom Header and Header Text is hidden. |
91 | - if ( empty( $header_image ) && ! display_header_text() ) : |
|
91 | + if (empty($header_image) && ! display_header_text()) : |
|
92 | 92 | ?> |
93 | 93 | .site-header { |
94 | 94 | padding-top: 14px; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | endif; |
131 | 131 | |
132 | 132 | // Has a Custom Header been added? |
133 | - if ( ! empty( $header_image ) ) : |
|
133 | + if ( ! empty($header_image)) : |
|
134 | 134 | ?> |
135 | 135 | .site-header { |
136 | 136 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | endif; |
173 | 173 | |
174 | 174 | // Has the text been hidden? |
175 | - if ( ! display_header_text() ) : |
|
175 | + if ( ! display_header_text()) : |
|
176 | 176 | ?> |
177 | 177 | .site-title, |
178 | 178 | .site-description { |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | function twentyfifteen_header_background_color_css() { |
196 | 196 | $color_scheme = twentyfifteen_get_color_scheme(); |
197 | 197 | $default_color = $color_scheme[1]; |
198 | - $header_background_color = get_theme_mod( 'header_background_color', $default_color ); |
|
198 | + $header_background_color = get_theme_mod('header_background_color', $default_color); |
|
199 | 199 | |
200 | 200 | // Don't do anything if the current color is the default. |
201 | - if ( $header_background_color === $default_color ) { |
|
201 | + if ($header_background_color === $default_color) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | } |
228 | 228 | '; |
229 | 229 | |
230 | - wp_add_inline_style( 'twentyfifteen-style', sprintf( $css, $header_background_color ) ); |
|
230 | + wp_add_inline_style('twentyfifteen-style', sprintf($css, $header_background_color)); |
|
231 | 231 | } |
232 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_header_background_color_css', 11 ); |
|
232 | +add_action('wp_enqueue_scripts', 'twentyfifteen_header_background_color_css', 11); |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Enqueues front-end CSS for the sidebar text color. |
@@ -239,18 +239,18 @@ discard block |
||
239 | 239 | function twentyfifteen_sidebar_text_color_css() { |
240 | 240 | $color_scheme = twentyfifteen_get_color_scheme(); |
241 | 241 | $default_color = $color_scheme[4]; |
242 | - $sidebar_link_color = get_theme_mod( 'sidebar_textcolor', $default_color ); |
|
242 | + $sidebar_link_color = get_theme_mod('sidebar_textcolor', $default_color); |
|
243 | 243 | |
244 | 244 | // Don't do anything if the current color is the default. |
245 | - if ( $sidebar_link_color === $default_color ) { |
|
245 | + if ($sidebar_link_color === $default_color) { |
|
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | 249 | // If we get this far, we have custom styles. Let's do this. |
250 | - $sidebar_link_color_rgb = twentyfifteen_hex2rgb( $sidebar_link_color ); |
|
251 | - $sidebar_text_color = vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $sidebar_link_color_rgb ); |
|
252 | - $sidebar_border_color = vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $sidebar_link_color_rgb ); |
|
253 | - $sidebar_border_focus_color = vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $sidebar_link_color_rgb ); |
|
250 | + $sidebar_link_color_rgb = twentyfifteen_hex2rgb($sidebar_link_color); |
|
251 | + $sidebar_text_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $sidebar_link_color_rgb); |
|
252 | + $sidebar_border_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $sidebar_link_color_rgb); |
|
253 | + $sidebar_border_focus_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $sidebar_link_color_rgb); |
|
254 | 254 | |
255 | 255 | $css = ' |
256 | 256 | /* Custom Sidebar Text Color */ |
@@ -365,6 +365,6 @@ discard block |
||
365 | 365 | } |
366 | 366 | '; |
367 | 367 | |
368 | - wp_add_inline_style( 'twentyfifteen-style', sprintf( $css, $sidebar_link_color, $sidebar_text_color, $sidebar_border_color, $sidebar_border_focus_color ) ); |
|
368 | + wp_add_inline_style('twentyfifteen-style', sprintf($css, $sidebar_link_color, $sidebar_text_color, $sidebar_border_color, $sidebar_border_focus_color)); |
|
369 | 369 | } |
370 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_sidebar_text_color_css', 11 ); |
|
370 | +add_action('wp_enqueue_scripts', 'twentyfifteen_sidebar_text_color_css', 11); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Custom template tags for Twenty Fifteen |
|
4 | - * |
|
5 | - * Eventually, some of the functionality here could be replaced by core features. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Twenty_Fifteen |
|
9 | - * @since Twenty Fifteen 1.0 |
|
10 | - */ |
|
3 | + * Custom template tags for Twenty Fifteen |
|
4 | + * |
|
5 | + * Eventually, some of the functionality here could be replaced by core features. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Twenty_Fifteen |
|
9 | + * @since Twenty Fifteen 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) : |
13 | 13 | /** |
@@ -192,9 +192,12 @@ |
||
192 | 192 | <?php the_post_thumbnail(); ?> |
193 | 193 | </div><!-- .post-thumbnail --> |
194 | 194 | |
195 | - <?php else : ?> |
|
195 | + <?php else { |
|
196 | + : ?> |
|
196 | 197 | |
197 | - <a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true"> |
|
198 | + <a class="post-thumbnail" href="<?php the_permalink(); |
|
199 | +} |
|
200 | +?>" aria-hidden="true"> |
|
198 | 201 | <?php |
199 | 202 | the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) ); |
200 | 203 | ?> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since Twenty Fifteen 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) : |
|
12 | +if ( ! function_exists('twentyfifteen_comment_nav')) : |
|
13 | 13 | /** |
14 | 14 | * Display navigation to next/previous comments when applicable. |
15 | 15 | * |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function twentyfifteen_comment_nav() { |
19 | 19 | // Are there comments to navigate through? |
20 | - if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : |
|
20 | + if (get_comment_pages_count() > 1 && get_option('page_comments')) : |
|
21 | 21 | ?> |
22 | 22 | <nav class="navigation comment-navigation" role="navigation"> |
23 | - <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2> |
|
23 | + <h2 class="screen-reader-text"><?php _e('Comment navigation', 'twentyfifteen'); ?></h2> |
|
24 | 24 | <div class="nav-links"> |
25 | 25 | <?php |
26 | - if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) : |
|
27 | - printf( '<div class="nav-previous">%s</div>', $prev_link ); |
|
26 | + if ($prev_link = get_previous_comments_link(__('Older Comments', 'twentyfifteen'))) : |
|
27 | + printf('<div class="nav-previous">%s</div>', $prev_link); |
|
28 | 28 | endif; |
29 | 29 | |
30 | - if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) : |
|
31 | - printf( '<div class="nav-next">%s</div>', $next_link ); |
|
30 | + if ($next_link = get_next_comments_link(__('Newer Comments', 'twentyfifteen'))) : |
|
31 | + printf('<div class="nav-next">%s</div>', $next_link); |
|
32 | 32 | endif; |
33 | 33 | ?> |
34 | 34 | </div><!-- .nav-links --> |
@@ -38,89 +38,89 @@ discard block |
||
38 | 38 | } |
39 | 39 | endif; |
40 | 40 | |
41 | -if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) : |
|
41 | +if ( ! function_exists('twentyfifteen_entry_meta')) : |
|
42 | 42 | /** |
43 | 43 | * Prints HTML with meta information for the categories, tags. |
44 | 44 | * |
45 | 45 | * @since Twenty Fifteen 1.0 |
46 | 46 | */ |
47 | 47 | function twentyfifteen_entry_meta() { |
48 | - if ( is_sticky() && is_home() && ! is_paged() ) { |
|
49 | - printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) ); |
|
48 | + if (is_sticky() && is_home() && ! is_paged()) { |
|
49 | + printf('<span class="sticky-post">%s</span>', __('Featured', 'twentyfifteen')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $format = get_post_format(); |
53 | - if ( current_theme_supports( 'post-formats', $format ) ) { |
|
54 | - printf( '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', |
|
55 | - sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ), |
|
56 | - esc_url( get_post_format_link( $format ) ), |
|
57 | - get_post_format_string( $format ) |
|
53 | + if (current_theme_supports('post-formats', $format)) { |
|
54 | + printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', |
|
55 | + sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentyfifteen')), |
|
56 | + esc_url(get_post_format_link($format)), |
|
57 | + get_post_format_string($format) |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
61 | - if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { |
|
61 | + if (in_array(get_post_type(), array('post', 'attachment'))) { |
|
62 | 62 | $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; |
63 | 63 | |
64 | - if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { |
|
64 | + if (get_the_time('U') !== get_the_modified_time('U')) { |
|
65 | 65 | $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; |
66 | 66 | } |
67 | 67 | |
68 | - $time_string = sprintf( $time_string, |
|
69 | - esc_attr( get_the_date( 'c' ) ), |
|
68 | + $time_string = sprintf($time_string, |
|
69 | + esc_attr(get_the_date('c')), |
|
70 | 70 | get_the_date(), |
71 | - esc_attr( get_the_modified_date( 'c' ) ), |
|
71 | + esc_attr(get_the_modified_date('c')), |
|
72 | 72 | get_the_modified_date() |
73 | 73 | ); |
74 | 74 | |
75 | - printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', |
|
76 | - _x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ), |
|
77 | - esc_url( get_permalink() ), |
|
75 | + printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', |
|
76 | + _x('Posted on', 'Used before publish date.', 'twentyfifteen'), |
|
77 | + esc_url(get_permalink()), |
|
78 | 78 | $time_string |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | - if ( 'post' == get_post_type() ) { |
|
83 | - if ( is_singular() || is_multi_author() ) { |
|
84 | - printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', |
|
85 | - _x( 'Author', 'Used before post author name.', 'twentyfifteen' ), |
|
86 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
82 | + if ('post' == get_post_type()) { |
|
83 | + if (is_singular() || is_multi_author()) { |
|
84 | + printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', |
|
85 | + _x('Author', 'Used before post author name.', 'twentyfifteen'), |
|
86 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
87 | 87 | get_the_author() |
88 | 88 | ); |
89 | 89 | } |
90 | 90 | |
91 | - $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); |
|
92 | - if ( $categories_list && twentyfifteen_categorized_blog() ) { |
|
93 | - printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', |
|
94 | - _x( 'Categories', 'Used before category names.', 'twentyfifteen' ), |
|
91 | + $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen')); |
|
92 | + if ($categories_list && twentyfifteen_categorized_blog()) { |
|
93 | + printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', |
|
94 | + _x('Categories', 'Used before category names.', 'twentyfifteen'), |
|
95 | 95 | $categories_list |
96 | 96 | ); |
97 | 97 | } |
98 | 98 | |
99 | - $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); |
|
100 | - if ( $tags_list ) { |
|
101 | - printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', |
|
102 | - _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ), |
|
99 | + $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen')); |
|
100 | + if ($tags_list) { |
|
101 | + printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', |
|
102 | + _x('Tags', 'Used before tag names.', 'twentyfifteen'), |
|
103 | 103 | $tags_list |
104 | 104 | ); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if ( is_attachment() && wp_attachment_is_image() ) { |
|
108 | + if (is_attachment() && wp_attachment_is_image()) { |
|
109 | 109 | // Retrieve attachment metadata. |
110 | 110 | $metadata = wp_get_attachment_metadata(); |
111 | 111 | |
112 | - printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', |
|
113 | - _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ), |
|
114 | - esc_url( wp_get_attachment_url() ), |
|
112 | + printf('<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', |
|
113 | + _x('Full size', 'Used before full size attachment link.', 'twentyfifteen'), |
|
114 | + esc_url(wp_get_attachment_url()), |
|
115 | 115 | $metadata['width'], |
116 | 116 | $metadata['height'] |
117 | 117 | ); |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { |
|
120 | + if ( ! is_single() && ! post_password_required() && (comments_open() || get_comments_number())) { |
|
121 | 121 | echo '<span class="comments-link">'; |
122 | 122 | /* translators: %s: post title */ |
123 | - comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) ); |
|
123 | + comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen'), get_the_title())); |
|
124 | 124 | echo '</span>'; |
125 | 125 | } |
126 | 126 | } |
@@ -134,23 +134,23 @@ discard block |
||
134 | 134 | * @return bool True of there is more than one category, false otherwise. |
135 | 135 | */ |
136 | 136 | function twentyfifteen_categorized_blog() { |
137 | - if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) { |
|
137 | + if (false === ($all_the_cool_cats = get_transient('twentyfifteen_categories'))) { |
|
138 | 138 | // Create an array of all the categories that are attached to posts. |
139 | - $all_the_cool_cats = get_categories( array( |
|
139 | + $all_the_cool_cats = get_categories(array( |
|
140 | 140 | 'fields' => 'ids', |
141 | 141 | 'hide_empty' => 1, |
142 | 142 | |
143 | 143 | // We only need to know if there is more than one category. |
144 | 144 | 'number' => 2, |
145 | - ) ); |
|
145 | + )); |
|
146 | 146 | |
147 | 147 | // Count the number of categories that are attached to the posts. |
148 | - $all_the_cool_cats = count( $all_the_cool_cats ); |
|
148 | + $all_the_cool_cats = count($all_the_cool_cats); |
|
149 | 149 | |
150 | - set_transient( 'twentyfifteen_categories', $all_the_cool_cats ); |
|
150 | + set_transient('twentyfifteen_categories', $all_the_cool_cats); |
|
151 | 151 | } |
152 | 152 | |
153 | - if ( $all_the_cool_cats > 1 ) { |
|
153 | + if ($all_the_cool_cats > 1) { |
|
154 | 154 | // This blog has more than 1 category so twentyfifteen_categorized_blog should return true. |
155 | 155 | return true; |
156 | 156 | } else { |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function twentyfifteen_category_transient_flusher() { |
168 | 168 | // Like, beat it. Dig? |
169 | - delete_transient( 'twentyfifteen_categories' ); |
|
169 | + delete_transient('twentyfifteen_categories'); |
|
170 | 170 | } |
171 | -add_action( 'edit_category', 'twentyfifteen_category_transient_flusher' ); |
|
172 | -add_action( 'save_post', 'twentyfifteen_category_transient_flusher' ); |
|
171 | +add_action('edit_category', 'twentyfifteen_category_transient_flusher'); |
|
172 | +add_action('save_post', 'twentyfifteen_category_transient_flusher'); |
|
173 | 173 | |
174 | -if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) : |
|
174 | +if ( ! function_exists('twentyfifteen_post_thumbnail')) : |
|
175 | 175 | /** |
176 | 176 | * Display an optional post thumbnail. |
177 | 177 | * |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | * @since Twenty Fifteen 1.0 |
182 | 182 | */ |
183 | 183 | function twentyfifteen_post_thumbnail() { |
184 | - if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { |
|
184 | + if (post_password_required() || is_attachment() || ! has_post_thumbnail()) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | - if ( is_singular() ) : |
|
188 | + if (is_singular()) : |
|
189 | 189 | ?> |
190 | 190 | |
191 | 191 | <div class="post-thumbnail"> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | <a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true"> |
198 | 198 | <?php |
199 | - the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) ); |
|
199 | + the_post_thumbnail('post-thumbnail', array('alt' => get_the_title())); |
|
200 | 200 | ?> |
201 | 201 | </a> |
202 | 202 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | endif; |
206 | 206 | |
207 | -if ( ! function_exists( 'twentyfifteen_get_link_url' ) ) : |
|
207 | +if ( ! function_exists('twentyfifteen_get_link_url')) : |
|
208 | 208 | /** |
209 | 209 | * Return the post URL. |
210 | 210 | * |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * @return string The Link format URL. |
218 | 218 | */ |
219 | 219 | function twentyfifteen_get_link_url() { |
220 | - $has_url = get_url_in_content( get_the_content() ); |
|
220 | + $has_url = get_url_in_content(get_the_content()); |
|
221 | 221 | |
222 | - return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() ); |
|
222 | + return $has_url ? $has_url : apply_filters('the_permalink', get_permalink()); |
|
223 | 223 | } |
224 | 224 | endif; |
225 | 225 | |
226 | -if ( ! function_exists( 'twentyfifteen_excerpt_more' ) && ! is_admin() ) : |
|
226 | +if ( ! function_exists('twentyfifteen_excerpt_more') && ! is_admin()) : |
|
227 | 227 | /** |
228 | 228 | * Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link. |
229 | 229 | * |
@@ -231,18 +231,18 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return string 'Continue reading' link prepended with an ellipsis. |
233 | 233 | */ |
234 | -function twentyfifteen_excerpt_more( $more ) { |
|
235 | - $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>', |
|
236 | - esc_url( get_permalink( get_the_ID() ) ), |
|
234 | +function twentyfifteen_excerpt_more($more) { |
|
235 | + $link = sprintf('<a href="%1$s" class="more-link">%2$s</a>', |
|
236 | + esc_url(get_permalink(get_the_ID())), |
|
237 | 237 | /* translators: %s: Name of current post */ |
238 | - sprintf( __( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) |
|
238 | + sprintf(__('Continue reading %s', 'twentyfifteen'), '<span class="screen-reader-text">'.get_the_title(get_the_ID()).'</span>') |
|
239 | 239 | ); |
240 | - return ' … ' . $link; |
|
240 | + return ' … '.$link; |
|
241 | 241 | } |
242 | -add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' ); |
|
242 | +add_filter('excerpt_more', 'twentyfifteen_excerpt_more'); |
|
243 | 243 | endif; |
244 | 244 | |
245 | -if ( ! function_exists( 'twentyfifteen_the_custom_logo' ) ) : |
|
245 | +if ( ! function_exists('twentyfifteen_the_custom_logo')) : |
|
246 | 246 | /** |
247 | 247 | * Displays the optional custom logo. |
248 | 248 | * |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @since Twenty Fifteen 1.5 |
252 | 252 | */ |
253 | 253 | function twentyfifteen_the_custom_logo() { |
254 | - if ( function_exists( 'the_custom_logo' ) ) { |
|
254 | + if (function_exists('the_custom_logo')) { |
|
255 | 255 | the_custom_logo(); |
256 | 256 | } |
257 | 257 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Twenty Fifteen Customizer functionality |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Twenty_Fifteen |
|
7 | - * @since Twenty Fifteen 1.0 |
|
8 | - */ |
|
3 | + * Twenty Fifteen Customizer functionality |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Twenty_Fifteen |
|
7 | + * @since Twenty Fifteen 1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Add postMessage support for site title and description for the Customizer. |
@@ -14,73 +14,73 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param WP_Customize_Manager $wp_customize Customizer object. |
16 | 16 | */ |
17 | -function twentyfifteen_customize_register( $wp_customize ) { |
|
17 | +function twentyfifteen_customize_register($wp_customize) { |
|
18 | 18 | $color_scheme = twentyfifteen_get_color_scheme(); |
19 | 19 | |
20 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
21 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
20 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
21 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
22 | 22 | |
23 | - if ( isset( $wp_customize->selective_refresh ) ) { |
|
24 | - $wp_customize->selective_refresh->add_partial( 'blogname', array( |
|
23 | + if (isset($wp_customize->selective_refresh)) { |
|
24 | + $wp_customize->selective_refresh->add_partial('blogname', array( |
|
25 | 25 | 'selector' => '.site-title a', |
26 | 26 | 'container_inclusive' => false, |
27 | 27 | 'render_callback' => 'twentyfifteen_customize_partial_blogname', |
28 | - ) ); |
|
29 | - $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
|
28 | + )); |
|
29 | + $wp_customize->selective_refresh->add_partial('blogdescription', array( |
|
30 | 30 | 'selector' => '.site-description', |
31 | 31 | 'container_inclusive' => false, |
32 | 32 | 'render_callback' => 'twentyfifteen_customize_partial_blogdescription', |
33 | - ) ); |
|
33 | + )); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Add color scheme setting and control. |
37 | - $wp_customize->add_setting( 'color_scheme', array( |
|
37 | + $wp_customize->add_setting('color_scheme', array( |
|
38 | 38 | 'default' => 'default', |
39 | 39 | 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', |
40 | 40 | 'transport' => 'postMessage', |
41 | - ) ); |
|
41 | + )); |
|
42 | 42 | |
43 | - $wp_customize->add_control( 'color_scheme', array( |
|
44 | - 'label' => __( 'Base Color Scheme', 'twentyfifteen' ), |
|
43 | + $wp_customize->add_control('color_scheme', array( |
|
44 | + 'label' => __('Base Color Scheme', 'twentyfifteen'), |
|
45 | 45 | 'section' => 'colors', |
46 | 46 | 'type' => 'select', |
47 | 47 | 'choices' => twentyfifteen_get_color_scheme_choices(), |
48 | 48 | 'priority' => 1, |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | 51 | // Add custom header and sidebar text color setting and control. |
52 | - $wp_customize->add_setting( 'sidebar_textcolor', array( |
|
52 | + $wp_customize->add_setting('sidebar_textcolor', array( |
|
53 | 53 | 'default' => $color_scheme[4], |
54 | 54 | 'sanitize_callback' => 'sanitize_hex_color', |
55 | 55 | 'transport' => 'postMessage', |
56 | - ) ); |
|
56 | + )); |
|
57 | 57 | |
58 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( |
|
59 | - 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ), |
|
60 | - 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), |
|
58 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array( |
|
59 | + 'label' => __('Header and Sidebar Text Color', 'twentyfifteen'), |
|
60 | + 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen'), |
|
61 | 61 | 'section' => 'colors', |
62 | - ) ) ); |
|
62 | + ))); |
|
63 | 63 | |
64 | 64 | // Remove the core header textcolor control, as it shares the sidebar text color. |
65 | - $wp_customize->remove_control( 'header_textcolor' ); |
|
65 | + $wp_customize->remove_control('header_textcolor'); |
|
66 | 66 | |
67 | 67 | // Add custom header and sidebar background color setting and control. |
68 | - $wp_customize->add_setting( 'header_background_color', array( |
|
68 | + $wp_customize->add_setting('header_background_color', array( |
|
69 | 69 | 'default' => $color_scheme[1], |
70 | 70 | 'sanitize_callback' => 'sanitize_hex_color', |
71 | 71 | 'transport' => 'postMessage', |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | |
74 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( |
|
75 | - 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ), |
|
76 | - 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), |
|
74 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array( |
|
75 | + 'label' => __('Header and Sidebar Background Color', 'twentyfifteen'), |
|
76 | + 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen'), |
|
77 | 77 | 'section' => 'colors', |
78 | - ) ) ); |
|
78 | + ))); |
|
79 | 79 | |
80 | 80 | // Add an additional description to the header image section. |
81 | - $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); |
|
81 | + $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen'); |
|
82 | 82 | } |
83 | -add_action( 'customize_register', 'twentyfifteen_customize_register', 11 ); |
|
83 | +add_action('customize_register', 'twentyfifteen_customize_register', 11); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Render the site title for the selective refresh partial. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | function twentyfifteen_customize_partial_blogname() { |
94 | - bloginfo( 'name' ); |
|
94 | + bloginfo('name'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return void |
104 | 104 | */ |
105 | 105 | function twentyfifteen_customize_partial_blogdescription() { |
106 | - bloginfo( 'description' ); |
|
106 | + bloginfo('description'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * } |
146 | 146 | * } |
147 | 147 | */ |
148 | - return apply_filters( 'twentyfifteen_color_schemes', array( |
|
148 | + return apply_filters('twentyfifteen_color_schemes', array( |
|
149 | 149 | 'default' => array( |
150 | - 'label' => __( 'Default', 'twentyfifteen' ), |
|
150 | + 'label' => __('Default', 'twentyfifteen'), |
|
151 | 151 | 'colors' => array( |
152 | 152 | '#f1f1f1', |
153 | 153 | '#ffffff', |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | ), |
159 | 159 | ), |
160 | 160 | 'dark' => array( |
161 | - 'label' => __( 'Dark', 'twentyfifteen' ), |
|
161 | + 'label' => __('Dark', 'twentyfifteen'), |
|
162 | 162 | 'colors' => array( |
163 | 163 | '#111111', |
164 | 164 | '#202020', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ), |
170 | 170 | ), |
171 | 171 | 'yellow' => array( |
172 | - 'label' => __( 'Yellow', 'twentyfifteen' ), |
|
172 | + 'label' => __('Yellow', 'twentyfifteen'), |
|
173 | 173 | 'colors' => array( |
174 | 174 | '#f4ca16', |
175 | 175 | '#ffdf00', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | ), |
181 | 181 | ), |
182 | 182 | 'pink' => array( |
183 | - 'label' => __( 'Pink', 'twentyfifteen' ), |
|
183 | + 'label' => __('Pink', 'twentyfifteen'), |
|
184 | 184 | 'colors' => array( |
185 | 185 | '#ffe5d1', |
186 | 186 | '#e53b51', |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | ), |
192 | 192 | ), |
193 | 193 | 'purple' => array( |
194 | - 'label' => __( 'Purple', 'twentyfifteen' ), |
|
194 | + 'label' => __('Purple', 'twentyfifteen'), |
|
195 | 195 | 'colors' => array( |
196 | 196 | '#674970', |
197 | 197 | '#2e2256', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ), |
203 | 203 | ), |
204 | 204 | 'blue' => array( |
205 | - 'label' => __( 'Blue', 'twentyfifteen' ), |
|
205 | + 'label' => __('Blue', 'twentyfifteen'), |
|
206 | 206 | 'colors' => array( |
207 | 207 | '#e9f2f9', |
208 | 208 | '#55c3dc', |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | '#f1f1f1', |
213 | 213 | ), |
214 | 214 | ), |
215 | - ) ); |
|
215 | + )); |
|
216 | 216 | } |
217 | 217 | |
218 | -if ( ! function_exists( 'twentyfifteen_get_color_scheme' ) ) : |
|
218 | +if ( ! function_exists('twentyfifteen_get_color_scheme')) : |
|
219 | 219 | /** |
220 | 220 | * Get the current Twenty Fifteen color scheme. |
221 | 221 | * |
@@ -224,18 +224,18 @@ discard block |
||
224 | 224 | * @return array An associative array of either the current or default color scheme hex values. |
225 | 225 | */ |
226 | 226 | function twentyfifteen_get_color_scheme() { |
227 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
227 | + $color_scheme_option = get_theme_mod('color_scheme', 'default'); |
|
228 | 228 | $color_schemes = twentyfifteen_get_color_schemes(); |
229 | 229 | |
230 | - if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { |
|
231 | - return $color_schemes[ $color_scheme_option ]['colors']; |
|
230 | + if (array_key_exists($color_scheme_option, $color_schemes)) { |
|
231 | + return $color_schemes[$color_scheme_option]['colors']; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | return $color_schemes['default']['colors']; |
235 | 235 | } |
236 | 236 | endif; // twentyfifteen_get_color_scheme |
237 | 237 | |
238 | -if ( ! function_exists( 'twentyfifteen_get_color_scheme_choices' ) ) : |
|
238 | +if ( ! function_exists('twentyfifteen_get_color_scheme_choices')) : |
|
239 | 239 | /** |
240 | 240 | * Returns an array of color scheme choices registered for Twenty Fifteen. |
241 | 241 | * |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | $color_schemes = twentyfifteen_get_color_schemes(); |
248 | 248 | $color_scheme_control_options = array(); |
249 | 249 | |
250 | - foreach ( $color_schemes as $color_scheme => $value ) { |
|
251 | - $color_scheme_control_options[ $color_scheme ] = $value['label']; |
|
250 | + foreach ($color_schemes as $color_scheme => $value) { |
|
251 | + $color_scheme_control_options[$color_scheme] = $value['label']; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | return $color_scheme_control_options; |
255 | 255 | } |
256 | 256 | endif; // twentyfifteen_get_color_scheme_choices |
257 | 257 | |
258 | -if ( ! function_exists( 'twentyfifteen_sanitize_color_scheme' ) ) : |
|
258 | +if ( ! function_exists('twentyfifteen_sanitize_color_scheme')) : |
|
259 | 259 | /** |
260 | 260 | * Sanitization callback for color schemes. |
261 | 261 | * |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | * @param string $value Color scheme name value. |
265 | 265 | * @return string Color scheme name. |
266 | 266 | */ |
267 | -function twentyfifteen_sanitize_color_scheme( $value ) { |
|
267 | +function twentyfifteen_sanitize_color_scheme($value) { |
|
268 | 268 | $color_schemes = twentyfifteen_get_color_scheme_choices(); |
269 | 269 | |
270 | - if ( ! array_key_exists( $value, $color_schemes ) ) { |
|
270 | + if ( ! array_key_exists($value, $color_schemes)) { |
|
271 | 271 | $value = 'default'; |
272 | 272 | } |
273 | 273 | |
@@ -283,38 +283,38 @@ discard block |
||
283 | 283 | * @see wp_add_inline_style() |
284 | 284 | */ |
285 | 285 | function twentyfifteen_color_scheme_css() { |
286 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
286 | + $color_scheme_option = get_theme_mod('color_scheme', 'default'); |
|
287 | 287 | |
288 | 288 | // Don't do anything if the default color scheme is selected. |
289 | - if ( 'default' === $color_scheme_option ) { |
|
289 | + if ('default' === $color_scheme_option) { |
|
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $color_scheme = twentyfifteen_get_color_scheme(); |
294 | 294 | |
295 | 295 | // Convert main and sidebar text hex color to rgba. |
296 | - $color_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[3] ); |
|
297 | - $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] ); |
|
296 | + $color_textcolor_rgb = twentyfifteen_hex2rgb($color_scheme[3]); |
|
297 | + $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb($color_scheme[4]); |
|
298 | 298 | $colors = array( |
299 | 299 | 'background_color' => $color_scheme[0], |
300 | 300 | 'header_background_color' => $color_scheme[1], |
301 | 301 | 'box_background_color' => $color_scheme[2], |
302 | 302 | 'textcolor' => $color_scheme[3], |
303 | - 'secondary_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ), |
|
304 | - 'border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ), |
|
305 | - 'border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ), |
|
303 | + 'secondary_textcolor' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb), |
|
304 | + 'border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb), |
|
305 | + 'border_focus_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb), |
|
306 | 306 | 'sidebar_textcolor' => $color_scheme[4], |
307 | - 'sidebar_border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ), |
|
308 | - 'sidebar_border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ), |
|
309 | - 'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ), |
|
307 | + 'sidebar_border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb), |
|
308 | + 'sidebar_border_focus_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb), |
|
309 | + 'secondary_sidebar_textcolor' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb), |
|
310 | 310 | 'meta_box_background_color' => $color_scheme[5], |
311 | 311 | ); |
312 | 312 | |
313 | - $color_scheme_css = twentyfifteen_get_color_scheme_css( $colors ); |
|
313 | + $color_scheme_css = twentyfifteen_get_color_scheme_css($colors); |
|
314 | 314 | |
315 | - wp_add_inline_style( 'twentyfifteen-style', $color_scheme_css ); |
|
315 | + wp_add_inline_style('twentyfifteen-style', $color_scheme_css); |
|
316 | 316 | } |
317 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_color_scheme_css' ); |
|
317 | +add_action('wp_enqueue_scripts', 'twentyfifteen_color_scheme_css'); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Binds JS listener to make Customizer color_scheme control. |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * @since Twenty Fifteen 1.0 |
325 | 325 | */ |
326 | 326 | function twentyfifteen_customize_control_js() { |
327 | - wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true ); |
|
328 | - wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() ); |
|
327 | + wp_enqueue_script('color-scheme-control', get_template_directory_uri().'/js/color-scheme-control.js', array('customize-controls', 'iris', 'underscore', 'wp-util'), '20141216', true); |
|
328 | + wp_localize_script('color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes()); |
|
329 | 329 | } |
330 | -add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' ); |
|
330 | +add_action('customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js'); |
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Binds JS handlers to make the Customizer preview reload changes asynchronously. |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * @since Twenty Fifteen 1.0 |
336 | 336 | */ |
337 | 337 | function twentyfifteen_customize_preview_js() { |
338 | - wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true ); |
|
338 | + wp_enqueue_script('twentyfifteen-customize-preview', get_template_directory_uri().'/js/customize-preview.js', array('customize-preview'), '20141216', true); |
|
339 | 339 | } |
340 | -add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' ); |
|
340 | +add_action('customize_preview_init', 'twentyfifteen_customize_preview_js'); |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Returns CSS for the color schemes. |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | * @param array $colors Color scheme colors. |
348 | 348 | * @return string Color scheme CSS. |
349 | 349 | */ |
350 | -function twentyfifteen_get_color_scheme_css( $colors ) { |
|
351 | - $colors = wp_parse_args( $colors, array( |
|
350 | +function twentyfifteen_get_color_scheme_css($colors) { |
|
351 | + $colors = wp_parse_args($colors, array( |
|
352 | 352 | 'background_color' => '', |
353 | 353 | 'header_background_color' => '', |
354 | 354 | 'box_background_color' => '', |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | 'sidebar_border_focus_color' => '', |
362 | 362 | 'secondary_sidebar_textcolor' => '', |
363 | 363 | 'meta_box_background_color' => '', |
364 | - ) ); |
|
364 | + )); |
|
365 | 365 | |
366 | 366 | $css = <<<CSS |
367 | 367 | /* Color Scheme */ |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | ); |
767 | 767 | ?> |
768 | 768 | <script type="text/html" id="tmpl-twentyfifteen-color-scheme"> |
769 | - <?php echo twentyfifteen_get_color_scheme_css( $colors ); ?> |
|
769 | + <?php echo twentyfifteen_get_color_scheme_css($colors); ?> |
|
770 | 770 | </script> |
771 | 771 | <?php |
772 | 772 | } |
773 | -add_action( 'customize_controls_print_footer_scripts', 'twentyfifteen_color_scheme_css_template' ); |
|
773 | +add_action('customize_controls_print_footer_scripts', 'twentyfifteen_color_scheme_css_template'); |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The template for displaying archive pages |
|
4 | - * |
|
5 | - * Used to display archive-type pages if nothing more specific matches a query. |
|
6 | - * For example, puts together date-based pages if no date.php file exists. |
|
7 | - * |
|
8 | - * If you'd like to further customize these archive views, you may create a |
|
9 | - * new template file for each one. For example, tag.php (Tag archives), |
|
10 | - * category.php (Category archives), author.php (Author archives), etc. |
|
11 | - * |
|
12 | - * @link https://codex.wordpress.org/Template_Hierarchy |
|
13 | - * |
|
14 | - * @package WordPress |
|
15 | - * @subpackage Twenty_Fifteen |
|
16 | - * @since Twenty Fifteen 1.0 |
|
17 | - */ |
|
3 | + * The template for displaying archive pages |
|
4 | + * |
|
5 | + * Used to display archive-type pages if nothing more specific matches a query. |
|
6 | + * For example, puts together date-based pages if no date.php file exists. |
|
7 | + * |
|
8 | + * If you'd like to further customize these archive views, you may create a |
|
9 | + * new template file for each one. For example, tag.php (Tag archives), |
|
10 | + * category.php (Category archives), author.php (Author archives), etc. |
|
11 | + * |
|
12 | + * @link https://codex.wordpress.org/Template_Hierarchy |
|
13 | + * |
|
14 | + * @package WordPress |
|
15 | + * @subpackage Twenty_Fifteen |
|
16 | + * @since Twenty Fifteen 1.0 |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | get_header(); ?> |
20 | 20 |
@@ -21,39 +21,39 @@ |
||
21 | 21 | <section id="primary" class="content-area"> |
22 | 22 | <main id="main" class="site-main" role="main"> |
23 | 23 | |
24 | - <?php if ( have_posts() ) : ?> |
|
24 | + <?php if (have_posts()) : ?> |
|
25 | 25 | |
26 | 26 | <header class="page-header"> |
27 | 27 | <?php |
28 | - the_archive_title( '<h1 class="page-title">', '</h1>' ); |
|
29 | - the_archive_description( '<div class="taxonomy-description">', '</div>' ); |
|
28 | + the_archive_title('<h1 class="page-title">', '</h1>'); |
|
29 | + the_archive_description('<div class="taxonomy-description">', '</div>'); |
|
30 | 30 | ?> |
31 | 31 | </header><!-- .page-header --> |
32 | 32 | |
33 | 33 | <?php |
34 | 34 | // Start the Loop. |
35 | - while ( have_posts() ) : the_post(); |
|
35 | + while (have_posts()) : the_post(); |
|
36 | 36 | |
37 | 37 | /* |
38 | 38 | * Include the Post-Format-specific template for the content. |
39 | 39 | * If you want to override this in a child theme, then include a file |
40 | 40 | * called content-___.php (where ___ is the Post Format name) and that will be used instead. |
41 | 41 | */ |
42 | - get_template_part( 'content', get_post_format() ); |
|
42 | + get_template_part('content', get_post_format()); |
|
43 | 43 | |
44 | 44 | // End the loop. |
45 | 45 | endwhile; |
46 | 46 | |
47 | 47 | // Previous/next page navigation. |
48 | - the_posts_pagination( array( |
|
49 | - 'prev_text' => __( 'Previous page', 'twentyfifteen' ), |
|
50 | - 'next_text' => __( 'Next page', 'twentyfifteen' ), |
|
51 | - 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', |
|
52 | - ) ); |
|
48 | + the_posts_pagination(array( |
|
49 | + 'prev_text' => __('Previous page', 'twentyfifteen'), |
|
50 | + 'next_text' => __('Next page', 'twentyfifteen'), |
|
51 | + 'before_page_number' => '<span class="meta-nav screen-reader-text">'.__('Page', 'twentyfifteen').' </span>', |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | // If no content, include the "No posts found" template. |
55 | 55 | else : |
56 | - get_template_part( 'content', 'none' ); |
|
56 | + get_template_part('content', 'none'); |
|
57 | 57 | |
58 | 58 | endif; |
59 | 59 | ?> |
@@ -52,8 +52,10 @@ |
||
52 | 52 | ) ); |
53 | 53 | |
54 | 54 | // If no content, include the "No posts found" template. |
55 | - else : |
|
55 | + else { |
|
56 | + : |
|
56 | 57 | get_template_part( 'content', 'none' ); |
58 | + } |
|
57 | 59 | |
58 | 60 | endif; |
59 | 61 | ?> |
@@ -14,29 +14,29 @@ |
||
14 | 14 | |
15 | 15 | <?php |
16 | 16 | // Start the loop. |
17 | - while ( have_posts() ) : the_post(); |
|
17 | + while (have_posts()) : the_post(); |
|
18 | 18 | |
19 | 19 | /* |
20 | 20 | * Include the post format-specific template for the content. If you want to |
21 | 21 | * use this in a child theme, then include a file called called content-___.php |
22 | 22 | * (where ___ is the post format) and that will be used instead. |
23 | 23 | */ |
24 | - get_template_part( 'content', get_post_format() ); |
|
24 | + get_template_part('content', get_post_format()); |
|
25 | 25 | |
26 | 26 | // If comments are open or we have at least one comment, load up the comment template. |
27 | - if ( comments_open() || get_comments_number() ) : |
|
27 | + if (comments_open() || get_comments_number()) : |
|
28 | 28 | comments_template(); |
29 | 29 | endif; |
30 | 30 | |
31 | 31 | // Previous/next post navigation. |
32 | - the_post_navigation( array( |
|
33 | - 'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next', 'twentyfifteen' ) . '</span> ' . |
|
34 | - '<span class="screen-reader-text">' . __( 'Next post:', 'twentyfifteen' ) . '</span> ' . |
|
32 | + the_post_navigation(array( |
|
33 | + 'next_text' => '<span class="meta-nav" aria-hidden="true">'.__('Next', 'twentyfifteen').'</span> '. |
|
34 | + '<span class="screen-reader-text">'.__('Next post:', 'twentyfifteen').'</span> '. |
|
35 | 35 | '<span class="post-title">%title</span>', |
36 | - 'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous', 'twentyfifteen' ) . '</span> ' . |
|
37 | - '<span class="screen-reader-text">' . __( 'Previous post:', 'twentyfifteen' ) . '</span> ' . |
|
36 | + 'prev_text' => '<span class="meta-nav" aria-hidden="true">'.__('Previous', 'twentyfifteen').'</span> '. |
|
37 | + '<span class="screen-reader-text">'.__('Previous post:', 'twentyfifteen').'</span> '. |
|
38 | 38 | '<span class="post-title">%title</span>', |
39 | - ) ); |
|
39 | + )); |
|
40 | 40 | |
41 | 41 | // End the loop. |
42 | 42 | endwhile; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The template used for displaying page content |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Twenty_Fifteen |
|
7 | - * @since Twenty Fifteen 1.0 |
|
8 | - */ |
|
3 | + * The template used for displaying page content |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Twenty_Fifteen |
|
7 | + * @since Twenty Fifteen 1.0 |
|
8 | + */ |
|
9 | 9 | ?> |
10 | 10 | |
11 | 11 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
@@ -15,23 +15,23 @@ |
||
15 | 15 | ?> |
16 | 16 | |
17 | 17 | <header class="entry-header"> |
18 | - <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> |
|
18 | + <?php the_title('<h1 class="entry-title">', '</h1>'); ?> |
|
19 | 19 | </header><!-- .entry-header --> |
20 | 20 | |
21 | 21 | <div class="entry-content"> |
22 | 22 | <?php the_content(); ?> |
23 | 23 | <?php |
24 | - wp_link_pages( array( |
|
25 | - 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', |
|
24 | + wp_link_pages(array( |
|
25 | + 'before' => '<div class="page-links"><span class="page-links-title">'.__('Pages:', 'twentyfifteen').'</span>', |
|
26 | 26 | 'after' => '</div>', |
27 | 27 | 'link_before' => '<span>', |
28 | 28 | 'link_after' => '</span>', |
29 | - 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', |
|
29 | + 'pagelink' => '<span class="screen-reader-text">'.__('Page', 'twentyfifteen').' </span>%', |
|
30 | 30 | 'separator' => '<span class="screen-reader-text">, </span>', |
31 | - ) ); |
|
31 | + )); |
|
32 | 32 | ?> |
33 | 33 | </div><!-- .entry-content --> |
34 | 34 | |
35 | - <?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->' ); ?> |
|
35 | + <?php edit_post_link(__('Edit', 'twentyfifteen'), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->'); ?> |
|
36 | 36 | |
37 | 37 | </article><!-- #post-## --> |
@@ -14,11 +14,11 @@ |
||
14 | 14 | |
15 | 15 | <section class="error-404 not-found"> |
16 | 16 | <header class="page-header"> |
17 | - <h1 class="page-title"><?php _e( 'Oops! That page can’t be found.', 'twentyfifteen' ); ?></h1> |
|
17 | + <h1 class="page-title"><?php _e('Oops! That page can’t be found.', 'twentyfifteen'); ?></h1> |
|
18 | 18 | </header><!-- .page-header --> |
19 | 19 | |
20 | 20 | <div class="page-content"> |
21 | - <p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentyfifteen' ); ?></p> |
|
21 | + <p><?php _e('It looks like nothing was found at this location. Maybe try a search?', 'twentyfifteen'); ?></p> |
|
22 | 22 | |
23 | 23 | <?php get_search_form(); ?> |
24 | 24 | </div><!-- .page-content --> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The template for displaying 404 pages (not found) |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Twenty_Fifteen |
|
7 | - * @since Twenty Fifteen 1.0 |
|
8 | - */ |
|
3 | + * The template for displaying 404 pages (not found) |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Twenty_Fifteen |
|
7 | + * @since Twenty Fifteen 1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | get_header(); ?> |
11 | 11 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | ?> |
10 | 10 | |
11 | 11 | <div class="author-info"> |
12 | - <h2 class="author-heading"><?php _e( 'Published by', 'twentyfifteen' ); ?></h2> |
|
12 | + <h2 class="author-heading"><?php _e('Published by', 'twentyfifteen'); ?></h2> |
|
13 | 13 | <div class="author-avatar"> |
14 | 14 | <?php |
15 | 15 | /** |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param int $size The avatar height and width size in pixels. |
21 | 21 | */ |
22 | - $author_bio_avatar_size = apply_filters( 'twentyfifteen_author_bio_avatar_size', 56 ); |
|
22 | + $author_bio_avatar_size = apply_filters('twentyfifteen_author_bio_avatar_size', 56); |
|
23 | 23 | |
24 | - echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size ); |
|
24 | + echo get_avatar(get_the_author_meta('user_email'), $author_bio_avatar_size); |
|
25 | 25 | ?> |
26 | 26 | </div><!-- .author-avatar --> |
27 | 27 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | <h3 class="author-title"><?php echo get_the_author(); ?></h3> |
30 | 30 | |
31 | 31 | <p class="author-bio"> |
32 | - <?php the_author_meta( 'description' ); ?> |
|
33 | - <a class="author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author"> |
|
34 | - <?php printf( __( 'View all posts by %s', 'twentyfifteen' ), get_the_author() ); ?> |
|
32 | + <?php the_author_meta('description'); ?> |
|
33 | + <a class="author-link" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>" rel="author"> |
|
34 | + <?php printf(__('View all posts by %s', 'twentyfifteen'), get_the_author()); ?> |
|
35 | 35 | </a> |
36 | 36 | </p><!-- .author-bio --> |
37 | 37 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The template for displaying Author bios |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Twenty_Fifteen |
|
7 | - * @since Twenty Fifteen 1.0 |
|
8 | - */ |
|
3 | + * The template for displaying Author bios |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Twenty_Fifteen |
|
7 | + * @since Twenty Fifteen 1.0 |
|
8 | + */ |
|
9 | 9 | ?> |
10 | 10 | |
11 | 11 | <div class="author-info"> |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | <header class="entry-header"> |
20 | 20 | <?php |
21 | - if ( is_single() ) : |
|
22 | - the_title( '<h1 class="entry-title">', '</h1>' ); |
|
21 | + if (is_single()) : |
|
22 | + the_title('<h1 class="entry-title">', '</h1>'); |
|
23 | 23 | else : |
24 | - the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); |
|
24 | + the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); |
|
25 | 25 | endif; |
26 | 26 | ?> |
27 | 27 | </header><!-- .entry-header --> |
@@ -29,32 +29,32 @@ discard block |
||
29 | 29 | <div class="entry-content"> |
30 | 30 | <?php |
31 | 31 | /* translators: %s: Name of current post */ |
32 | - the_content( sprintf( |
|
33 | - __( 'Continue reading %s', 'twentyfifteen' ), |
|
34 | - the_title( '<span class="screen-reader-text">', '</span>', false ) |
|
35 | - ) ); |
|
32 | + the_content(sprintf( |
|
33 | + __('Continue reading %s', 'twentyfifteen'), |
|
34 | + the_title('<span class="screen-reader-text">', '</span>', false) |
|
35 | + )); |
|
36 | 36 | |
37 | - wp_link_pages( array( |
|
38 | - 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', |
|
37 | + wp_link_pages(array( |
|
38 | + 'before' => '<div class="page-links"><span class="page-links-title">'.__('Pages:', 'twentyfifteen').'</span>', |
|
39 | 39 | 'after' => '</div>', |
40 | 40 | 'link_before' => '<span>', |
41 | 41 | 'link_after' => '</span>', |
42 | - 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', |
|
42 | + 'pagelink' => '<span class="screen-reader-text">'.__('Page', 'twentyfifteen').' </span>%', |
|
43 | 43 | 'separator' => '<span class="screen-reader-text">, </span>', |
44 | - ) ); |
|
44 | + )); |
|
45 | 45 | ?> |
46 | 46 | </div><!-- .entry-content --> |
47 | 47 | |
48 | 48 | <?php |
49 | 49 | // Author bio. |
50 | - if ( is_single() && get_the_author_meta( 'description' ) ) : |
|
51 | - get_template_part( 'author-bio' ); |
|
50 | + if (is_single() && get_the_author_meta('description')) : |
|
51 | + get_template_part('author-bio'); |
|
52 | 52 | endif; |
53 | 53 | ?> |
54 | 54 | |
55 | 55 | <footer class="entry-footer"> |
56 | 56 | <?php twentyfifteen_entry_meta(); ?> |
57 | - <?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?> |
|
57 | + <?php edit_post_link(__('Edit', 'twentyfifteen'), '<span class="edit-link">', '</span>'); ?> |
|
58 | 58 | </footer><!-- .entry-footer --> |
59 | 59 | |
60 | 60 | </article><!-- #post-## --> |
@@ -21,8 +21,10 @@ |
||
21 | 21 | |
22 | 22 | if ( is_single() ) : |
23 | 23 | the_title( '<h1 class="entry-title">', '</h1>' ); |
24 | - else : |
|
24 | + else { |
|
25 | + : |
|
25 | 26 | the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); |
27 | + } |
|
26 | 28 | endif; |
27 | 29 | ?> |
28 | 30 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The default template for displaying content |
|
4 | - * |
|
5 | - * Used for both single and index/archive/search. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Twenty_Fifteen |
|
9 | - * @since Twenty Fifteen 1.0 |
|
10 | - */ |
|
3 | + * The default template for displaying content |
|
4 | + * |
|
5 | + * Used for both single and index/archive/search. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Twenty_Fifteen |
|
9 | + * @since Twenty Fifteen 1.0 |
|
10 | + */ |
|
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |