@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | get_header(); ?> |
19 | 19 | |
20 | 20 | <div class="wrap"> |
21 | - <?php if ( is_home() && ! is_front_page() ) : ?> |
|
21 | + <?php if (is_home() && ! is_front_page()) : ?> |
|
22 | 22 | <header class="page-header"> |
23 | 23 | <h1 class="page-title"><?php single_post_title(); ?></h1> |
24 | 24 | </header> |
25 | 25 | <?php else : ?> |
26 | 26 | <header class="page-header"> |
27 | - <h2 class="page-title"><?php _e( 'Posts', 'twentyseventeen' ); ?></h2> |
|
27 | + <h2 class="page-title"><?php _e('Posts', 'twentyseventeen'); ?></h2> |
|
28 | 28 | </header> |
29 | 29 | <?php endif; ?> |
30 | 30 | |
@@ -32,29 +32,29 @@ discard block |
||
32 | 32 | <main id="main" class="site-main" role="main"> |
33 | 33 | |
34 | 34 | <?php |
35 | - if ( have_posts() ) : |
|
35 | + if (have_posts()) : |
|
36 | 36 | |
37 | 37 | /* Start the Loop */ |
38 | - while ( have_posts() ) : the_post(); |
|
38 | + while (have_posts()) : the_post(); |
|
39 | 39 | |
40 | 40 | /* |
41 | 41 | * Include the Post-Format-specific template for the content. |
42 | 42 | * If you want to override this in a child theme, then include a file |
43 | 43 | * called content-___.php (where ___ is the Post Format name) and that will be used instead. |
44 | 44 | */ |
45 | - get_template_part( 'template-parts/post/content', get_post_format() ); |
|
45 | + get_template_part('template-parts/post/content', get_post_format()); |
|
46 | 46 | |
47 | 47 | endwhile; |
48 | 48 | |
49 | - the_posts_pagination( array( |
|
50 | - 'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>', |
|
51 | - 'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ), |
|
52 | - 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>', |
|
53 | - ) ); |
|
49 | + the_posts_pagination(array( |
|
50 | + 'prev_text' => twentyseventeen_get_svg(array('icon' => 'arrow-left')).'<span class="screen-reader-text">'.__('Previous page', 'twentyseventeen').'</span>', |
|
51 | + 'next_text' => '<span class="screen-reader-text">'.__('Next page', 'twentyseventeen').'</span>'.twentyseventeen_get_svg(array('icon' => 'arrow-right')), |
|
52 | + 'before_page_number' => '<span class="meta-nav screen-reader-text">'.__('Page', 'twentyseventeen').' </span>', |
|
53 | + )); |
|
54 | 54 | |
55 | 55 | else : |
56 | 56 | |
57 | - get_template_part( 'template-parts/post/content', 'none' ); |
|
57 | + get_template_part('template-parts/post/content', 'none'); |
|
58 | 58 | |
59 | 59 | endif; |
60 | 60 | ?> |
@@ -22,9 +22,12 @@ discard block |
||
22 | 22 | <header class="page-header"> |
23 | 23 | <h1 class="page-title"><?php single_post_title(); ?></h1> |
24 | 24 | </header> |
25 | - <?php else : ?> |
|
25 | + <?php else { |
|
26 | + : ?> |
|
26 | 27 | <header class="page-header"> |
27 | - <h2 class="page-title"><?php _e( 'Posts', 'twentyseventeen' ); ?></h2> |
|
28 | + <h2 class="page-title"><?php _e( 'Posts', 'twentyseventeen' ); |
|
29 | +} |
|
30 | +?></h2> |
|
28 | 31 | </header> |
29 | 32 | <?php endif; ?> |
30 | 33 | |
@@ -52,9 +55,11 @@ discard block |
||
52 | 55 | 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>', |
53 | 56 | ) ); |
54 | 57 | |
55 | - else : |
|
58 | + else { |
|
59 | + : |
|
56 | 60 | |
57 | 61 | get_template_part( 'template-parts/post/content', 'none' ); |
62 | + } |
|
58 | 63 | |
59 | 64 | endif; |
60 | 65 | ?> |
@@ -18,10 +18,10 @@ |
||
18 | 18 | |
19 | 19 | <section class="error-404 not-found"> |
20 | 20 | <header class="page-header"> |
21 | - <h1 class="page-title"><?php _e( 'Oops! That page can’t be found.', 'twentyseventeen' ); ?></h1> |
|
21 | + <h1 class="page-title"><?php _e('Oops! That page can’t be found.', 'twentyseventeen'); ?></h1> |
|
22 | 22 | </header><!-- .page-header --> |
23 | 23 | <div class="page-content"> |
24 | - <p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentyseventeen' ); ?></p> |
|
24 | + <p><?php _e('It looks like nothing was found at this location. Maybe try a search?', 'twentyseventeen'); ?></p> |
|
25 | 25 | |
26 | 26 | <?php get_search_form(); ?> |
27 | 27 |
@@ -10,12 +10,12 @@ |
||
10 | 10 | |
11 | 11 | ?> |
12 | 12 | |
13 | -<?php $unique_id = esc_attr( uniqid( 'search-form-' ) ); ?> |
|
13 | +<?php $unique_id = esc_attr(uniqid('search-form-')); ?> |
|
14 | 14 | |
15 | -<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> |
|
15 | +<form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>"> |
|
16 | 16 | <label for="<?php echo $unique_id; ?>"> |
17 | - <span class="screen-reader-text"><?php echo _x( 'Search for:', 'label', 'twentyseventeen' ); ?></span> |
|
17 | + <span class="screen-reader-text"><?php echo _x('Search for:', 'label', 'twentyseventeen'); ?></span> |
|
18 | 18 | </label> |
19 | - <input type="search" id="<?php echo $unique_id; ?>" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder', 'twentyseventeen' ); ?>" value="<?php echo get_search_query(); ?>" name="s" /> |
|
20 | - <button type="submit" class="search-submit"><?php echo twentyseventeen_get_svg( array( 'icon' => 'search' ) ); ?><span class="screen-reader-text"><?php echo _x( 'Search', 'submit button', 'twentyseventeen' ); ?></span></button> |
|
19 | + <input type="search" id="<?php echo $unique_id; ?>" class="search-field" placeholder="<?php echo esc_attr_x('Search …', 'placeholder', 'twentyseventeen'); ?>" value="<?php echo get_search_query(); ?>" name="s" /> |
|
20 | + <button type="submit" class="search-submit"><?php echo twentyseventeen_get_svg(array('icon' => 'search')); ?><span class="screen-reader-text"><?php echo _x('Search', 'submit button', 'twentyseventeen'); ?></span></button> |
|
21 | 21 | </form> |
@@ -19,23 +19,23 @@ |
||
19 | 19 | <footer id="colophon" class="site-footer" role="contentinfo"> |
20 | 20 | <div class="wrap"> |
21 | 21 | <?php |
22 | - get_template_part( 'template-parts/footer/footer', 'widgets' ); |
|
22 | + get_template_part('template-parts/footer/footer', 'widgets'); |
|
23 | 23 | |
24 | - if ( has_nav_menu( 'social' ) ) : ?> |
|
25 | - <nav class="social-navigation" role="navigation" aria-label="<?php _e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>"> |
|
24 | + if (has_nav_menu('social')) : ?> |
|
25 | + <nav class="social-navigation" role="navigation" aria-label="<?php _e('Footer Social Links Menu', 'twentyseventeen'); ?>"> |
|
26 | 26 | <?php |
27 | - wp_nav_menu( array( |
|
27 | + wp_nav_menu(array( |
|
28 | 28 | 'theme_location' => 'social', |
29 | 29 | 'menu_class' => 'social-links-menu', |
30 | 30 | 'depth' => 1, |
31 | 31 | 'link_before' => '<span class="screen-reader-text">', |
32 | - 'link_after' => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ), |
|
33 | - ) ); |
|
32 | + 'link_after' => '</span>'.twentyseventeen_get_svg(array('icon' => 'chain')), |
|
33 | + )); |
|
34 | 34 | ?> |
35 | 35 | </nav><!-- .social-navigation --> |
36 | 36 | <?php endif; |
37 | 37 | |
38 | - get_template_part( 'template-parts/footer/site', 'info' ); |
|
38 | + get_template_part('template-parts/footer/site', 'info'); |
|
39 | 39 | ?> |
40 | 40 | </div><!-- .wrap --> |
41 | 41 | </footer><!-- #colophon --> |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | <main id="main" class="site-main" role="main"> |
19 | 19 | |
20 | 20 | <?php // Show the selected frontpage content. |
21 | - if ( have_posts() ) : |
|
22 | - while ( have_posts() ) : the_post(); |
|
23 | - get_template_part( 'template-parts/page/content', 'front-page' ); |
|
21 | + if (have_posts()) : |
|
22 | + while (have_posts()) : the_post(); |
|
23 | + get_template_part('template-parts/page/content', 'front-page'); |
|
24 | 24 | endwhile; |
25 | 25 | else : // I'm not sure it's possible to have no posts when this page is shown, but WTH. |
26 | - get_template_part( 'template-parts/post/content', 'none' ); |
|
26 | + get_template_part('template-parts/post/content', 'none'); |
|
27 | 27 | endif; ?> |
28 | 28 | |
29 | 29 | <?php |
30 | 30 | // Get each of our panels and show the post data. |
31 | - if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show. |
|
31 | + if (0 !== twentyseventeen_panel_count() || is_customize_preview()) : // If we have pages to show. |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Filter number of front page sections in Twenty Seventeen. |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param $num_sections integer |
39 | 39 | */ |
40 | - $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); |
|
40 | + $num_sections = apply_filters('twentyseventeen_front_page_sections', 4); |
|
41 | 41 | global $twentyseventeencounter; |
42 | 42 | |
43 | 43 | // Create a setting and control for each of the sections available in the theme. |
44 | - for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { |
|
44 | + for ($i = 1; $i < (1 + $num_sections); $i++) { |
|
45 | 45 | $twentyseventeencounter = $i; |
46 | - twentyseventeen_front_page_section( null, $i ); |
|
46 | + twentyseventeen_front_page_section(null, $i); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here. ?> |
@@ -22,8 +22,10 @@ |
||
22 | 22 | while ( have_posts() ) : the_post(); |
23 | 23 | get_template_part( 'template-parts/page/content', 'front-page' ); |
24 | 24 | endwhile; |
25 | - else : // I'm not sure it's possible to have no posts when this page is shown, but WTH. |
|
25 | + else { |
|
26 | + : // I'm not sure it's possible to have no posts when this page is shown, but WTH. |
|
26 | 27 | get_template_part( 'template-parts/post/content', 'none' ); |
28 | + } |
|
27 | 29 | endif; ?> |
28 | 30 | |
29 | 31 | <?php |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | ?><!DOCTYPE html> |
16 | 16 | <html <?php language_attributes(); ?> class="no-js no-svg"> |
17 | 17 | <head> |
18 | -<meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
18 | +<meta charset="<?php bloginfo('charset'); ?>"> |
|
19 | 19 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
20 | 20 | <link rel="profile" href="http://gmpg.org/xfn/11"> |
21 | 21 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | |
25 | 25 | <body <?php body_class(); ?>> |
26 | 26 | <div id="page" class="site"> |
27 | - <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentyseventeen' ); ?></a> |
|
27 | + <a class="skip-link screen-reader-text" href="#content"><?php _e('Skip to content', 'twentyseventeen'); ?></a> |
|
28 | 28 | |
29 | 29 | <header id="masthead" class="site-header" role="banner"> |
30 | 30 | |
31 | - <?php get_template_part( 'template-parts/header/header', 'image' ); ?> |
|
31 | + <?php get_template_part('template-parts/header/header', 'image'); ?> |
|
32 | 32 | |
33 | - <?php if ( has_nav_menu( 'top' ) ) : ?> |
|
33 | + <?php if (has_nav_menu('top')) : ?> |
|
34 | 34 | <div class="navigation-top"> |
35 | 35 | <div class="wrap"> |
36 | - <?php get_template_part( 'template-parts/navigation/navigation', 'top' ); ?> |
|
36 | + <?php get_template_part('template-parts/navigation/navigation', 'top'); ?> |
|
37 | 37 | </div><!-- .wrap --> |
38 | 38 | </div><!-- .navigation-top --> |
39 | 39 | <?php endif; ?> |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * If a regular post or page, and not the front page, show the featured image. |
47 | 47 | * Using get_queried_object_id() here since the $post global may not be set before a call to the_post(). |
48 | 48 | */ |
49 | - if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) : |
|
49 | + if ((is_single() || (is_page() && ! twentyseventeen_is_frontpage())) && has_post_thumbnail(get_queried_object_id())) : |
|
50 | 50 | echo '<div class="single-featured-image-header">'; |
51 | - echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' ); |
|
51 | + echo get_the_post_thumbnail(get_queried_object_id(), 'twentyseventeen-featured-image'); |
|
52 | 52 | echo '</div><!-- .single-featured-image-header -->'; |
53 | 53 | endif; |
54 | 54 | ?> |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since Twenty Fourteen 1.0 |
34 | 34 | */ |
35 | -if ( ! isset( $content_width ) ) { |
|
35 | +if ( ! isset($content_width)) { |
|
36 | 36 | $content_width = 474; |
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Twenty Fourteen only works in WordPress 3.6 or later. |
41 | 41 | */ |
42 | -if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) { |
|
43 | - require get_template_directory() . '/inc/back-compat.php'; |
|
42 | +if (version_compare($GLOBALS['wp_version'], '3.6', '<')) { |
|
43 | + require get_template_directory().'/inc/back-compat.php'; |
|
44 | 44 | } |
45 | 45 | |
46 | -if ( ! function_exists( 'twentyfourteen_setup' ) ) : |
|
46 | +if ( ! function_exists('twentyfourteen_setup')) : |
|
47 | 47 | /** |
48 | 48 | * Twenty Fourteen setup. |
49 | 49 | * |
@@ -65,60 +65,60 @@ discard block |
||
65 | 65 | * replace to change 'twentyfourteen' to the name of your theme in all |
66 | 66 | * template files. |
67 | 67 | */ |
68 | - load_theme_textdomain( 'twentyfourteen' ); |
|
68 | + load_theme_textdomain('twentyfourteen'); |
|
69 | 69 | |
70 | 70 | // This theme styles the visual editor to resemble the theme style. |
71 | - add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) ); |
|
71 | + add_editor_style(array('css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css')); |
|
72 | 72 | |
73 | 73 | // Add RSS feed links to <head> for posts and comments. |
74 | - add_theme_support( 'automatic-feed-links' ); |
|
74 | + add_theme_support('automatic-feed-links'); |
|
75 | 75 | |
76 | 76 | // Enable support for Post Thumbnails, and declare two sizes. |
77 | - add_theme_support( 'post-thumbnails' ); |
|
78 | - set_post_thumbnail_size( 672, 372, true ); |
|
79 | - add_image_size( 'twentyfourteen-full-width', 1038, 576, true ); |
|
77 | + add_theme_support('post-thumbnails'); |
|
78 | + set_post_thumbnail_size(672, 372, true); |
|
79 | + add_image_size('twentyfourteen-full-width', 1038, 576, true); |
|
80 | 80 | |
81 | 81 | // This theme uses wp_nav_menu() in two locations. |
82 | - register_nav_menus( array( |
|
83 | - 'primary' => __( 'Top primary menu', 'twentyfourteen' ), |
|
84 | - 'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ), |
|
85 | - ) ); |
|
82 | + register_nav_menus(array( |
|
83 | + 'primary' => __('Top primary menu', 'twentyfourteen'), |
|
84 | + 'secondary' => __('Secondary menu in left sidebar', 'twentyfourteen'), |
|
85 | + )); |
|
86 | 86 | |
87 | 87 | /* |
88 | 88 | * Switch default core markup for search form, comment form, and comments |
89 | 89 | * to output valid HTML5. |
90 | 90 | */ |
91 | - add_theme_support( 'html5', array( |
|
91 | + add_theme_support('html5', array( |
|
92 | 92 | 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' |
93 | - ) ); |
|
93 | + )); |
|
94 | 94 | |
95 | 95 | /* |
96 | 96 | * Enable support for Post Formats. |
97 | 97 | * See https://codex.wordpress.org/Post_Formats |
98 | 98 | */ |
99 | - add_theme_support( 'post-formats', array( |
|
99 | + add_theme_support('post-formats', array( |
|
100 | 100 | 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | |
103 | 103 | // This theme allows users to set a custom background. |
104 | - add_theme_support( 'custom-background', apply_filters( 'twentyfourteen_custom_background_args', array( |
|
104 | + add_theme_support('custom-background', apply_filters('twentyfourteen_custom_background_args', array( |
|
105 | 105 | 'default-color' => 'f5f5f5', |
106 | - ) ) ); |
|
106 | + ))); |
|
107 | 107 | |
108 | 108 | // Add support for featured content. |
109 | - add_theme_support( 'featured-content', array( |
|
109 | + add_theme_support('featured-content', array( |
|
110 | 110 | 'featured_content_filter' => 'twentyfourteen_get_featured_posts', |
111 | 111 | 'max_posts' => 6, |
112 | - ) ); |
|
112 | + )); |
|
113 | 113 | |
114 | 114 | // This theme uses its own gallery styles. |
115 | - add_filter( 'use_default_gallery_style', '__return_false' ); |
|
115 | + add_filter('use_default_gallery_style', '__return_false'); |
|
116 | 116 | |
117 | 117 | // Indicate widget sidebars can use selective refresh in the Customizer. |
118 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
118 | + add_theme_support('customize-selective-refresh-widgets'); |
|
119 | 119 | } |
120 | 120 | endif; // twentyfourteen_setup |
121 | -add_action( 'after_setup_theme', 'twentyfourteen_setup' ); |
|
121 | +add_action('after_setup_theme', 'twentyfourteen_setup'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Adjust content_width value for image attachment template. |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | * @since Twenty Fourteen 1.0 |
127 | 127 | */ |
128 | 128 | function twentyfourteen_content_width() { |
129 | - if ( is_attachment() && wp_attachment_is_image() ) { |
|
129 | + if (is_attachment() && wp_attachment_is_image()) { |
|
130 | 130 | $GLOBALS['content_width'] = 810; |
131 | 131 | } |
132 | 132 | } |
133 | -add_action( 'template_redirect', 'twentyfourteen_content_width' ); |
|
133 | +add_action('template_redirect', 'twentyfourteen_content_width'); |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Getter function for Featured Content Plugin. |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @param array|bool $posts Array of featured posts, otherwise false. |
149 | 149 | */ |
150 | - return apply_filters( 'twentyfourteen_get_featured_posts', array() ); |
|
150 | + return apply_filters('twentyfourteen_get_featured_posts', array()); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -167,38 +167,38 @@ discard block |
||
167 | 167 | * @since Twenty Fourteen 1.0 |
168 | 168 | */ |
169 | 169 | function twentyfourteen_widgets_init() { |
170 | - require get_template_directory() . '/inc/widgets.php'; |
|
171 | - register_widget( 'Twenty_Fourteen_Ephemera_Widget' ); |
|
170 | + require get_template_directory().'/inc/widgets.php'; |
|
171 | + register_widget('Twenty_Fourteen_Ephemera_Widget'); |
|
172 | 172 | |
173 | - register_sidebar( array( |
|
174 | - 'name' => __( 'Primary Sidebar', 'twentyfourteen' ), |
|
173 | + register_sidebar(array( |
|
174 | + 'name' => __('Primary Sidebar', 'twentyfourteen'), |
|
175 | 175 | 'id' => 'sidebar-1', |
176 | - 'description' => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ), |
|
176 | + 'description' => __('Main sidebar that appears on the left.', 'twentyfourteen'), |
|
177 | 177 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
178 | 178 | 'after_widget' => '</aside>', |
179 | 179 | 'before_title' => '<h1 class="widget-title">', |
180 | 180 | 'after_title' => '</h1>', |
181 | - ) ); |
|
182 | - register_sidebar( array( |
|
183 | - 'name' => __( 'Content Sidebar', 'twentyfourteen' ), |
|
181 | + )); |
|
182 | + register_sidebar(array( |
|
183 | + 'name' => __('Content Sidebar', 'twentyfourteen'), |
|
184 | 184 | 'id' => 'sidebar-2', |
185 | - 'description' => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ), |
|
185 | + 'description' => __('Additional sidebar that appears on the right.', 'twentyfourteen'), |
|
186 | 186 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
187 | 187 | 'after_widget' => '</aside>', |
188 | 188 | 'before_title' => '<h1 class="widget-title">', |
189 | 189 | 'after_title' => '</h1>', |
190 | - ) ); |
|
191 | - register_sidebar( array( |
|
192 | - 'name' => __( 'Footer Widget Area', 'twentyfourteen' ), |
|
190 | + )); |
|
191 | + register_sidebar(array( |
|
192 | + 'name' => __('Footer Widget Area', 'twentyfourteen'), |
|
193 | 193 | 'id' => 'sidebar-3', |
194 | - 'description' => __( 'Appears in the footer section of the site.', 'twentyfourteen' ), |
|
194 | + 'description' => __('Appears in the footer section of the site.', 'twentyfourteen'), |
|
195 | 195 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
196 | 196 | 'after_widget' => '</aside>', |
197 | 197 | 'before_title' => '<h1 class="widget-title">', |
198 | 198 | 'after_title' => '</h1>', |
199 | - ) ); |
|
199 | + )); |
|
200 | 200 | } |
201 | -add_action( 'widgets_init', 'twentyfourteen_widgets_init' ); |
|
201 | +add_action('widgets_init', 'twentyfourteen_widgets_init'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Register Lato Google font for Twenty Fourteen. |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | * Translators: If there are characters in your language that are not supported |
214 | 214 | * by Lato, translate this to 'off'. Do not translate into your own language. |
215 | 215 | */ |
216 | - if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { |
|
216 | + if ('off' !== _x('on', 'Lato font: on or off', 'twentyfourteen')) { |
|
217 | 217 | $query_args = array( |
218 | - 'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), |
|
219 | - 'subset' => urlencode( 'latin,latin-ext' ), |
|
218 | + 'family' => urlencode('Lato:300,400,700,900,300italic,400italic,700italic'), |
|
219 | + 'subset' => urlencode('latin,latin-ext'), |
|
220 | 220 | ); |
221 | - $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); |
|
221 | + $font_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | return $font_url; |
@@ -231,41 +231,41 @@ discard block |
||
231 | 231 | */ |
232 | 232 | function twentyfourteen_scripts() { |
233 | 233 | // Add Lato font, used in the main stylesheet. |
234 | - wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); |
|
234 | + wp_enqueue_style('twentyfourteen-lato', twentyfourteen_font_url(), array(), null); |
|
235 | 235 | |
236 | 236 | // Add Genericons font, used in the main stylesheet. |
237 | - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); |
|
237 | + wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.0.3'); |
|
238 | 238 | |
239 | 239 | // Load our main stylesheet. |
240 | - wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri() ); |
|
240 | + wp_enqueue_style('twentyfourteen-style', get_stylesheet_uri()); |
|
241 | 241 | |
242 | 242 | // Load the Internet Explorer specific stylesheet. |
243 | - wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131205' ); |
|
244 | - wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); |
|
243 | + wp_enqueue_style('twentyfourteen-ie', get_template_directory_uri().'/css/ie.css', array('twentyfourteen-style'), '20131205'); |
|
244 | + wp_style_add_data('twentyfourteen-ie', 'conditional', 'lt IE 9'); |
|
245 | 245 | |
246 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
247 | - wp_enqueue_script( 'comment-reply' ); |
|
246 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
247 | + wp_enqueue_script('comment-reply'); |
|
248 | 248 | } |
249 | 249 | |
250 | - if ( is_singular() && wp_attachment_is_image() ) { |
|
251 | - wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); |
|
250 | + if (is_singular() && wp_attachment_is_image()) { |
|
251 | + wp_enqueue_script('twentyfourteen-keyboard-image-navigation', get_template_directory_uri().'/js/keyboard-image-navigation.js', array('jquery'), '20130402'); |
|
252 | 252 | } |
253 | 253 | |
254 | - if ( is_active_sidebar( 'sidebar-3' ) ) { |
|
255 | - wp_enqueue_script( 'jquery-masonry' ); |
|
254 | + if (is_active_sidebar('sidebar-3')) { |
|
255 | + wp_enqueue_script('jquery-masonry'); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { |
|
259 | - wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true ); |
|
260 | - wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array( |
|
261 | - 'prevText' => __( 'Previous', 'twentyfourteen' ), |
|
262 | - 'nextText' => __( 'Next', 'twentyfourteen' ) |
|
263 | - ) ); |
|
258 | + if (is_front_page() && 'slider' == get_theme_mod('featured_content_layout')) { |
|
259 | + wp_enqueue_script('twentyfourteen-slider', get_template_directory_uri().'/js/slider.js', array('jquery'), '20131205', true); |
|
260 | + wp_localize_script('twentyfourteen-slider', 'featuredSliderDefaults', array( |
|
261 | + 'prevText' => __('Previous', 'twentyfourteen'), |
|
262 | + 'nextText' => __('Next', 'twentyfourteen') |
|
263 | + )); |
|
264 | 264 | } |
265 | 265 | |
266 | - wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true ); |
|
266 | + wp_enqueue_script('twentyfourteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20150315', true); |
|
267 | 267 | } |
268 | -add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); |
|
268 | +add_action('wp_enqueue_scripts', 'twentyfourteen_scripts'); |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Enqueue Google fonts style to admin screen for custom header display. |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | * @since Twenty Fourteen 1.0 |
274 | 274 | */ |
275 | 275 | function twentyfourteen_admin_fonts() { |
276 | - wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); |
|
276 | + wp_enqueue_style('twentyfourteen-lato', twentyfourteen_font_url(), array(), null); |
|
277 | 277 | } |
278 | -add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' ); |
|
278 | +add_action('admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts'); |
|
279 | 279 | |
280 | 280 | /** |
281 | 281 | * Add preconnect for Google Fonts. |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | * @param string $relation_type The relation type the URLs are printed. |
287 | 287 | * @return array URLs to print for resource hints. |
288 | 288 | */ |
289 | -function twentyfourteen_resource_hints( $urls, $relation_type ) { |
|
290 | - if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) { |
|
291 | - if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { |
|
289 | +function twentyfourteen_resource_hints($urls, $relation_type) { |
|
290 | + if (wp_style_is('twentyfourteen-lato', 'queue') && 'preconnect' === $relation_type) { |
|
291 | + if (version_compare($GLOBALS['wp_version'], '4.7-alpha', '>=')) { |
|
292 | 292 | $urls[] = array( |
293 | 293 | 'href' => 'https://fonts.gstatic.com', |
294 | 294 | 'crossorigin', |
@@ -300,16 +300,16 @@ discard block |
||
300 | 300 | |
301 | 301 | return $urls; |
302 | 302 | } |
303 | -add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 ); |
|
303 | +add_filter('wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2); |
|
304 | 304 | |
305 | -if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : |
|
305 | +if ( ! function_exists('twentyfourteen_the_attached_image')) : |
|
306 | 306 | /** |
307 | 307 | * Print the attached image with a link to the next attached image. |
308 | 308 | * |
309 | 309 | * @since Twenty Fourteen 1.0 |
310 | 310 | */ |
311 | 311 | function twentyfourteen_the_attached_image() { |
312 | - $post = get_post(); |
|
312 | + $post = get_post(); |
|
313 | 313 | /** |
314 | 314 | * Filter the default Twenty Fourteen attachment size. |
315 | 315 | * |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @type int $width Width of the image in pixels. Default 810. |
323 | 323 | * } |
324 | 324 | */ |
325 | - $attachment_size = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) ); |
|
325 | + $attachment_size = apply_filters('twentyfourteen_attachment_size', array(810, 810)); |
|
326 | 326 | $next_attachment_url = wp_get_attachment_url(); |
327 | 327 | |
328 | 328 | /* |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * looking at the last image in a gallery), or, in a gallery of one, just the |
332 | 332 | * link to that image file. |
333 | 333 | */ |
334 | - $attachment_ids = get_posts( array( |
|
334 | + $attachment_ids = get_posts(array( |
|
335 | 335 | 'post_parent' => $post->post_parent, |
336 | 336 | 'fields' => 'ids', |
337 | 337 | 'numberposts' => -1, |
@@ -340,68 +340,68 @@ discard block |
||
340 | 340 | 'post_mime_type' => 'image', |
341 | 341 | 'order' => 'ASC', |
342 | 342 | 'orderby' => 'menu_order ID', |
343 | - ) ); |
|
343 | + )); |
|
344 | 344 | |
345 | 345 | // If there is more than 1 attachment in a gallery... |
346 | - if ( count( $attachment_ids ) > 1 ) { |
|
347 | - foreach ( $attachment_ids as $idx => $attachment_id ) { |
|
348 | - if ( $attachment_id == $post->ID ) { |
|
349 | - $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ]; |
|
346 | + if (count($attachment_ids) > 1) { |
|
347 | + foreach ($attachment_ids as $idx => $attachment_id) { |
|
348 | + if ($attachment_id == $post->ID) { |
|
349 | + $next_id = $attachment_ids[($idx + 1) % count($attachment_ids)]; |
|
350 | 350 | break; |
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | 354 | // get the URL of the next image attachment... |
355 | - if ( $next_id ) { |
|
356 | - $next_attachment_url = get_attachment_link( $next_id ); |
|
355 | + if ($next_id) { |
|
356 | + $next_attachment_url = get_attachment_link($next_id); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | // or get the URL of the first image attachment. |
360 | 360 | else { |
361 | - $next_attachment_url = get_attachment_link( reset( $attachment_ids ) ); |
|
361 | + $next_attachment_url = get_attachment_link(reset($attachment_ids)); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - printf( '<a href="%1$s" rel="attachment">%2$s</a>', |
|
366 | - esc_url( $next_attachment_url ), |
|
367 | - wp_get_attachment_image( $post->ID, $attachment_size ) |
|
365 | + printf('<a href="%1$s" rel="attachment">%2$s</a>', |
|
366 | + esc_url($next_attachment_url), |
|
367 | + wp_get_attachment_image($post->ID, $attachment_size) |
|
368 | 368 | ); |
369 | 369 | } |
370 | 370 | endif; |
371 | 371 | |
372 | -if ( ! function_exists( 'twentyfourteen_list_authors' ) ) : |
|
372 | +if ( ! function_exists('twentyfourteen_list_authors')) : |
|
373 | 373 | /** |
374 | 374 | * Print a list of all site contributors who published at least one post. |
375 | 375 | * |
376 | 376 | * @since Twenty Fourteen 1.0 |
377 | 377 | */ |
378 | 378 | function twentyfourteen_list_authors() { |
379 | - $contributor_ids = get_users( array( |
|
379 | + $contributor_ids = get_users(array( |
|
380 | 380 | 'fields' => 'ID', |
381 | 381 | 'orderby' => 'post_count', |
382 | 382 | 'order' => 'DESC', |
383 | 383 | 'who' => 'authors', |
384 | - ) ); |
|
384 | + )); |
|
385 | 385 | |
386 | - foreach ( $contributor_ids as $contributor_id ) : |
|
387 | - $post_count = count_user_posts( $contributor_id ); |
|
386 | + foreach ($contributor_ids as $contributor_id) : |
|
387 | + $post_count = count_user_posts($contributor_id); |
|
388 | 388 | |
389 | 389 | // Move on if user has not published a post (yet). |
390 | - if ( ! $post_count ) { |
|
390 | + if ( ! $post_count) { |
|
391 | 391 | continue; |
392 | 392 | } |
393 | 393 | ?> |
394 | 394 | |
395 | 395 | <div class="contributor"> |
396 | 396 | <div class="contributor-info"> |
397 | - <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div> |
|
397 | + <div class="contributor-avatar"><?php echo get_avatar($contributor_id, 132); ?></div> |
|
398 | 398 | <div class="contributor-summary"> |
399 | - <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2> |
|
399 | + <h2 class="contributor-name"><?php echo get_the_author_meta('display_name', $contributor_id); ?></h2> |
|
400 | 400 | <p class="contributor-bio"> |
401 | - <?php echo get_the_author_meta( 'description', $contributor_id ); ?> |
|
401 | + <?php echo get_the_author_meta('description', $contributor_id); ?> |
|
402 | 402 | </p> |
403 | - <a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>"> |
|
404 | - <?php printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); ?> |
|
403 | + <a class="button contributor-posts-link" href="<?php echo esc_url(get_author_posts_url($contributor_id)); ?>"> |
|
404 | + <?php printf(_n('%d Article', '%d Articles', $post_count, 'twentyfourteen'), $post_count); ?> |
|
405 | 405 | </a> |
406 | 406 | </div><!-- .contributor-summary --> |
407 | 407 | </div><!-- .contributor-info --> |
@@ -429,45 +429,45 @@ discard block |
||
429 | 429 | * @param array $classes A list of existing body class values. |
430 | 430 | * @return array The filtered body class list. |
431 | 431 | */ |
432 | -function twentyfourteen_body_classes( $classes ) { |
|
433 | - if ( is_multi_author() ) { |
|
432 | +function twentyfourteen_body_classes($classes) { |
|
433 | + if (is_multi_author()) { |
|
434 | 434 | $classes[] = 'group-blog'; |
435 | 435 | } |
436 | 436 | |
437 | - if ( get_header_image() ) { |
|
437 | + if (get_header_image()) { |
|
438 | 438 | $classes[] = 'header-image'; |
439 | - } elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) { |
|
439 | + } elseif ( ! in_array($GLOBALS['pagenow'], array('wp-activate.php', 'wp-signup.php'))) { |
|
440 | 440 | $classes[] = 'masthead-fixed'; |
441 | 441 | } |
442 | 442 | |
443 | - if ( is_archive() || is_search() || is_home() ) { |
|
443 | + if (is_archive() || is_search() || is_home()) { |
|
444 | 444 | $classes[] = 'list-view'; |
445 | 445 | } |
446 | 446 | |
447 | - if ( ( ! is_active_sidebar( 'sidebar-2' ) ) |
|
448 | - || is_page_template( 'page-templates/full-width.php' ) |
|
449 | - || is_page_template( 'page-templates/contributors.php' ) |
|
450 | - || is_attachment() ) { |
|
447 | + if (( ! is_active_sidebar('sidebar-2')) |
|
448 | + || is_page_template('page-templates/full-width.php') |
|
449 | + || is_page_template('page-templates/contributors.php') |
|
450 | + || is_attachment()) { |
|
451 | 451 | $classes[] = 'full-width'; |
452 | 452 | } |
453 | 453 | |
454 | - if ( is_active_sidebar( 'sidebar-3' ) ) { |
|
454 | + if (is_active_sidebar('sidebar-3')) { |
|
455 | 455 | $classes[] = 'footer-widgets'; |
456 | 456 | } |
457 | 457 | |
458 | - if ( is_singular() && ! is_front_page() ) { |
|
458 | + if (is_singular() && ! is_front_page()) { |
|
459 | 459 | $classes[] = 'singular'; |
460 | 460 | } |
461 | 461 | |
462 | - if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { |
|
462 | + if (is_front_page() && 'slider' == get_theme_mod('featured_content_layout')) { |
|
463 | 463 | $classes[] = 'slider'; |
464 | - } elseif ( is_front_page() ) { |
|
464 | + } elseif (is_front_page()) { |
|
465 | 465 | $classes[] = 'grid'; |
466 | 466 | } |
467 | 467 | |
468 | 468 | return $classes; |
469 | 469 | } |
470 | -add_filter( 'body_class', 'twentyfourteen_body_classes' ); |
|
470 | +add_filter('body_class', 'twentyfourteen_body_classes'); |
|
471 | 471 | |
472 | 472 | /** |
473 | 473 | * Extend the default WordPress post classes. |
@@ -480,14 +480,14 @@ discard block |
||
480 | 480 | * @param array $classes A list of existing post class values. |
481 | 481 | * @return array The filtered post class list. |
482 | 482 | */ |
483 | -function twentyfourteen_post_classes( $classes ) { |
|
484 | - if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) { |
|
483 | +function twentyfourteen_post_classes($classes) { |
|
484 | + if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail()) { |
|
485 | 485 | $classes[] = 'has-post-thumbnail'; |
486 | 486 | } |
487 | 487 | |
488 | 488 | return $classes; |
489 | 489 | } |
490 | -add_filter( 'post_class', 'twentyfourteen_post_classes' ); |
|
490 | +add_filter('post_class', 'twentyfourteen_post_classes'); |
|
491 | 491 | |
492 | 492 | /** |
493 | 493 | * Create a nicely formatted and more specific title element text for output |
@@ -502,39 +502,39 @@ discard block |
||
502 | 502 | * @param string $sep Optional separator. |
503 | 503 | * @return string The filtered title. |
504 | 504 | */ |
505 | -function twentyfourteen_wp_title( $title, $sep ) { |
|
505 | +function twentyfourteen_wp_title($title, $sep) { |
|
506 | 506 | global $paged, $page; |
507 | 507 | |
508 | - if ( is_feed() ) { |
|
508 | + if (is_feed()) { |
|
509 | 509 | return $title; |
510 | 510 | } |
511 | 511 | |
512 | 512 | // Add the site name. |
513 | - $title .= get_bloginfo( 'name', 'display' ); |
|
513 | + $title .= get_bloginfo('name', 'display'); |
|
514 | 514 | |
515 | 515 | // Add the site description for the home/front page. |
516 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
517 | - if ( $site_description && ( is_home() || is_front_page() ) ) { |
|
516 | + $site_description = get_bloginfo('description', 'display'); |
|
517 | + if ($site_description && (is_home() || is_front_page())) { |
|
518 | 518 | $title = "$title $sep $site_description"; |
519 | 519 | } |
520 | 520 | |
521 | 521 | // Add a page number if necessary. |
522 | - if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { |
|
523 | - $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); |
|
522 | + if (($paged >= 2 || $page >= 2) && ! is_404()) { |
|
523 | + $title = "$title $sep ".sprintf(__('Page %s', 'twentyfourteen'), max($paged, $page)); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | return $title; |
527 | 527 | } |
528 | -add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 ); |
|
528 | +add_filter('wp_title', 'twentyfourteen_wp_title', 10, 2); |
|
529 | 529 | |
530 | 530 | // Implement Custom Header features. |
531 | -require get_template_directory() . '/inc/custom-header.php'; |
|
531 | +require get_template_directory().'/inc/custom-header.php'; |
|
532 | 532 | |
533 | 533 | // Custom template tags for this theme. |
534 | -require get_template_directory() . '/inc/template-tags.php'; |
|
534 | +require get_template_directory().'/inc/template-tags.php'; |
|
535 | 535 | |
536 | 536 | // Add Customizer functionality. |
537 | -require get_template_directory() . '/inc/customizer.php'; |
|
537 | +require get_template_directory().'/inc/customizer.php'; |
|
538 | 538 | |
539 | 539 | /* |
540 | 540 | * Add Featured Content functionality. |
@@ -542,6 +542,6 @@ discard block |
||
542 | 542 | * To overwrite in a plugin, define your own Featured_Content class on or |
543 | 543 | * before the 'setup_theme' hook. |
544 | 544 | */ |
545 | -if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { |
|
546 | - require get_template_directory() . '/inc/featured-content.php'; |
|
545 | +if ( ! class_exists('Featured_Content') && 'plugins.php' !== $GLOBALS['pagenow']) { |
|
546 | + require get_template_directory().'/inc/featured-content.php'; |
|
547 | 547 | } |
@@ -14,68 +14,68 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param WP_Customize_Manager $wp_customize Customizer object. |
16 | 16 | */ |
17 | -function twentyfourteen_customize_register( $wp_customize ) { |
|
17 | +function twentyfourteen_customize_register($wp_customize) { |
|
18 | 18 | // Add postMessage support for site title and description. |
19 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
20 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
21 | - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
|
19 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
20 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
21 | + $wp_customize->get_setting('header_textcolor')->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' => 'twentyfourteen_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' => 'twentyfourteen_customize_partial_blogdescription', |
33 | - ) ); |
|
33 | + )); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Rename the label to "Site Title Color" because this only affects the site title in this theme. |
37 | - $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' ); |
|
37 | + $wp_customize->get_control('header_textcolor')->label = __('Site Title Color', 'twentyfourteen'); |
|
38 | 38 | |
39 | 39 | // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. |
40 | - $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'twentyfourteen' ); |
|
40 | + $wp_customize->get_control('display_header_text')->label = __('Display Site Title & Tagline', 'twentyfourteen'); |
|
41 | 41 | |
42 | 42 | // Add custom description to Colors and Background controls or sections. |
43 | - if ( property_exists( $wp_customize->get_control( 'background_color' ), 'description' ) ) { |
|
44 | - $wp_customize->get_control( 'background_color' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' ); |
|
45 | - $wp_customize->get_control( 'background_image' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' ); |
|
43 | + if (property_exists($wp_customize->get_control('background_color'), 'description')) { |
|
44 | + $wp_customize->get_control('background_color')->description = __('May only be visible on wide screens.', 'twentyfourteen'); |
|
45 | + $wp_customize->get_control('background_image')->description = __('May only be visible on wide screens.', 'twentyfourteen'); |
|
46 | 46 | } else { |
47 | - $wp_customize->get_section( 'colors' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); |
|
48 | - $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); |
|
47 | + $wp_customize->get_section('colors')->description = __('Background may only be visible on wide screens.', 'twentyfourteen'); |
|
48 | + $wp_customize->get_section('background_image')->description = __('Background may only be visible on wide screens.', 'twentyfourteen'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // Add the featured content section in case it's not already there. |
52 | - $wp_customize->add_section( 'featured_content', array( |
|
53 | - 'title' => __( 'Featured Content', 'twentyfourteen' ), |
|
54 | - 'description' => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), |
|
55 | - esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), |
|
56 | - admin_url( 'edit.php?show_sticky=1' ) |
|
52 | + $wp_customize->add_section('featured_content', array( |
|
53 | + 'title' => __('Featured Content', 'twentyfourteen'), |
|
54 | + 'description' => sprintf(__('Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen'), |
|
55 | + esc_url(add_query_arg('tag', _x('featured', 'featured content default tag slug', 'twentyfourteen'), admin_url('edit.php'))), |
|
56 | + admin_url('edit.php?show_sticky=1') |
|
57 | 57 | ), |
58 | 58 | 'priority' => 130, |
59 | 59 | 'active_callback' => 'is_front_page', |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | // Add the featured content layout setting and control. |
63 | - $wp_customize->add_setting( 'featured_content_layout', array( |
|
63 | + $wp_customize->add_setting('featured_content_layout', array( |
|
64 | 64 | 'default' => 'grid', |
65 | 65 | 'sanitize_callback' => 'twentyfourteen_sanitize_layout', |
66 | - ) ); |
|
66 | + )); |
|
67 | 67 | |
68 | - $wp_customize->add_control( 'featured_content_layout', array( |
|
69 | - 'label' => __( 'Layout', 'twentyfourteen' ), |
|
68 | + $wp_customize->add_control('featured_content_layout', array( |
|
69 | + 'label' => __('Layout', 'twentyfourteen'), |
|
70 | 70 | 'section' => 'featured_content', |
71 | 71 | 'type' => 'select', |
72 | 72 | 'choices' => array( |
73 | - 'grid' => __( 'Grid', 'twentyfourteen' ), |
|
74 | - 'slider' => __( 'Slider', 'twentyfourteen' ), |
|
73 | + 'grid' => __('Grid', 'twentyfourteen'), |
|
74 | + 'slider' => __('Slider', 'twentyfourteen'), |
|
75 | 75 | ), |
76 | - ) ); |
|
76 | + )); |
|
77 | 77 | } |
78 | -add_action( 'customize_register', 'twentyfourteen_customize_register' ); |
|
78 | +add_action('customize_register', 'twentyfourteen_customize_register'); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Render the site title for the selective refresh partial. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return void |
87 | 87 | */ |
88 | 88 | function twentyfourteen_customize_partial_blogname() { |
89 | - bloginfo( 'name' ); |
|
89 | + bloginfo('name'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | function twentyfourteen_customize_partial_blogdescription() { |
101 | - bloginfo( 'description' ); |
|
101 | + bloginfo('description'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param string $layout Layout type. |
110 | 110 | * @return string Filtered layout type (grid|slider). |
111 | 111 | */ |
112 | -function twentyfourteen_sanitize_layout( $layout ) { |
|
113 | - if ( ! in_array( $layout, array( 'grid', 'slider' ) ) ) { |
|
112 | +function twentyfourteen_sanitize_layout($layout) { |
|
113 | + if ( ! in_array($layout, array('grid', 'slider'))) { |
|
114 | 114 | $layout = 'grid'; |
115 | 115 | } |
116 | 116 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * @since Twenty Fourteen 1.0 |
124 | 124 | */ |
125 | 125 | function twentyfourteen_customize_preview_js() { |
126 | - wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20131205', true ); |
|
126 | + wp_enqueue_script('twentyfourteen_customizer', get_template_directory_uri().'/js/customizer.js', array('customize-preview'), '20131205', true); |
|
127 | 127 | } |
128 | -add_action( 'customize_preview_init', 'twentyfourteen_customize_preview_js' ); |
|
128 | +add_action('customize_preview_init', 'twentyfourteen_customize_preview_js'); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Add contextual help to the Themes and Post edit screens. |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | * @since Twenty Fourteen 1.0 |
134 | 134 | */ |
135 | 135 | function twentyfourteen_contextual_help() { |
136 | - if ( 'admin_head-edit.php' === current_filter() && 'post' !== $GLOBALS['typenow'] ) { |
|
136 | + if ('admin_head-edit.php' === current_filter() && 'post' !== $GLOBALS['typenow']) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | - get_current_screen()->add_help_tab( array( |
|
140 | + get_current_screen()->add_help_tab(array( |
|
141 | 141 | 'id' => 'twentyfourteen', |
142 | - 'title' => __( 'Twenty Fourteen', 'twentyfourteen' ), |
|
142 | + 'title' => __('Twenty Fourteen', 'twentyfourteen'), |
|
143 | 143 | 'content' => |
144 | - '<ul>' . |
|
145 | - '<li>' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance → Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '</li>' . |
|
146 | - '<li>' . sprintf( __( 'Enhance your site design by using <a href="%s">Featured Images</a> for posts you’d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages—above the title—and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '</li>' . |
|
147 | - '<li>' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen' ), 'https://codex.wordpress.org/Twenty_Fourteen' ) . '</li>' . |
|
144 | + '<ul>'. |
|
145 | + '<li>'.sprintf(__('The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance → Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen'), esc_url(add_query_arg('tag', _x('featured', 'featured content default tag slug', 'twentyfourteen'), admin_url('edit.php'))), admin_url('customize.php'), admin_url('edit.php?show_sticky=1')).'</li>'. |
|
146 | + '<li>'.sprintf(__('Enhance your site design by using <a href="%s">Featured Images</a> for posts you’d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages—above the title—and in the Featured Content area on the home page.', 'twentyfourteen'), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail').'</li>'. |
|
147 | + '<li>'.sprintf(__('For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen'), 'https://codex.wordpress.org/Twenty_Fourteen').'</li>'. |
|
148 | 148 | '</ul>', |
149 | - ) ); |
|
149 | + )); |
|
150 | 150 | } |
151 | -add_action( 'admin_head-themes.php', 'twentyfourteen_contextual_help' ); |
|
152 | -add_action( 'admin_head-edit.php', 'twentyfourteen_contextual_help' ); |
|
151 | +add_action('admin_head-themes.php', 'twentyfourteen_contextual_help'); |
|
152 | +add_action('admin_head-edit.php', 'twentyfourteen_contextual_help'); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since Twenty Fifteen 1.0 |
32 | 32 | */ |
33 | -if ( ! isset( $content_width ) ) { |
|
33 | +if ( ! isset($content_width)) { |
|
34 | 34 | $content_width = 660; |
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Twenty Fifteen only works in WordPress 4.1 or later. |
39 | 39 | */ |
40 | -if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) { |
|
41 | - require get_template_directory() . '/inc/back-compat.php'; |
|
40 | +if (version_compare($GLOBALS['wp_version'], '4.1-alpha', '<')) { |
|
41 | + require get_template_directory().'/inc/back-compat.php'; |
|
42 | 42 | } |
43 | 43 | |
44 | -if ( ! function_exists( 'twentyfifteen_setup' ) ) : |
|
44 | +if ( ! function_exists('twentyfifteen_setup')) : |
|
45 | 45 | /** |
46 | 46 | * Sets up theme defaults and registers support for various WordPress features. |
47 | 47 | * |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * If you're building a theme based on twentyfifteen, use a find and replace |
60 | 60 | * to change 'twentyfifteen' to the name of your theme in all the template files |
61 | 61 | */ |
62 | - load_theme_textdomain( 'twentyfifteen' ); |
|
62 | + load_theme_textdomain('twentyfifteen'); |
|
63 | 63 | |
64 | 64 | // Add default posts and comments RSS feed links to head. |
65 | - add_theme_support( 'automatic-feed-links' ); |
|
65 | + add_theme_support('automatic-feed-links'); |
|
66 | 66 | |
67 | 67 | /* |
68 | 68 | * Let WordPress manage the document title. |
@@ -70,52 +70,52 @@ discard block |
||
70 | 70 | * hard-coded <title> tag in the document head, and expect WordPress to |
71 | 71 | * provide it for us. |
72 | 72 | */ |
73 | - add_theme_support( 'title-tag' ); |
|
73 | + add_theme_support('title-tag'); |
|
74 | 74 | |
75 | 75 | /* |
76 | 76 | * Enable support for Post Thumbnails on posts and pages. |
77 | 77 | * |
78 | 78 | * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails |
79 | 79 | */ |
80 | - add_theme_support( 'post-thumbnails' ); |
|
81 | - set_post_thumbnail_size( 825, 510, true ); |
|
80 | + add_theme_support('post-thumbnails'); |
|
81 | + set_post_thumbnail_size(825, 510, true); |
|
82 | 82 | |
83 | 83 | // This theme uses wp_nav_menu() in two locations. |
84 | - register_nav_menus( array( |
|
85 | - 'primary' => __( 'Primary Menu', 'twentyfifteen' ), |
|
86 | - 'social' => __( 'Social Links Menu', 'twentyfifteen' ), |
|
87 | - ) ); |
|
84 | + register_nav_menus(array( |
|
85 | + 'primary' => __('Primary Menu', 'twentyfifteen'), |
|
86 | + 'social' => __('Social Links Menu', 'twentyfifteen'), |
|
87 | + )); |
|
88 | 88 | |
89 | 89 | /* |
90 | 90 | * Switch default core markup for search form, comment form, and comments |
91 | 91 | * to output valid HTML5. |
92 | 92 | */ |
93 | - add_theme_support( 'html5', array( |
|
93 | + add_theme_support('html5', array( |
|
94 | 94 | 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' |
95 | - ) ); |
|
95 | + )); |
|
96 | 96 | |
97 | 97 | /* |
98 | 98 | * Enable support for Post Formats. |
99 | 99 | * |
100 | 100 | * See: https://codex.wordpress.org/Post_Formats |
101 | 101 | */ |
102 | - add_theme_support( 'post-formats', array( |
|
102 | + add_theme_support('post-formats', array( |
|
103 | 103 | 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' |
104 | - ) ); |
|
104 | + )); |
|
105 | 105 | |
106 | 106 | /* |
107 | 107 | * Enable support for custom logo. |
108 | 108 | * |
109 | 109 | * @since Twenty Fifteen 1.5 |
110 | 110 | */ |
111 | - add_theme_support( 'custom-logo', array( |
|
111 | + add_theme_support('custom-logo', array( |
|
112 | 112 | 'height' => 248, |
113 | 113 | 'width' => 248, |
114 | 114 | 'flex-height' => true, |
115 | - ) ); |
|
115 | + )); |
|
116 | 116 | |
117 | 117 | $color_scheme = twentyfifteen_get_color_scheme(); |
118 | - $default_color = trim( $color_scheme[0], '#' ); |
|
118 | + $default_color = trim($color_scheme[0], '#'); |
|
119 | 119 | |
120 | 120 | // Setup the WordPress core custom background feature. |
121 | 121 | |
@@ -131,22 +131,22 @@ discard block |
||
131 | 131 | * @type string $default-attachment Default attachment of the header. |
132 | 132 | * } |
133 | 133 | */ |
134 | - add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array( |
|
134 | + add_theme_support('custom-background', apply_filters('twentyfifteen_custom_background_args', array( |
|
135 | 135 | 'default-color' => $default_color, |
136 | 136 | 'default-attachment' => 'fixed', |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | /* |
140 | 140 | * This theme styles the visual editor to resemble the theme style, |
141 | 141 | * specifically font, colors, icons, and column width. |
142 | 142 | */ |
143 | - add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) ); |
|
143 | + add_editor_style(array('css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url())); |
|
144 | 144 | |
145 | 145 | // Indicate widget sidebars can use selective refresh in the Customizer. |
146 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
146 | + add_theme_support('customize-selective-refresh-widgets'); |
|
147 | 147 | } |
148 | 148 | endif; // twentyfifteen_setup |
149 | -add_action( 'after_setup_theme', 'twentyfifteen_setup' ); |
|
149 | +add_action('after_setup_theme', 'twentyfifteen_setup'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Register widget area. |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | * @link https://codex.wordpress.org/Function_Reference/register_sidebar |
157 | 157 | */ |
158 | 158 | function twentyfifteen_widgets_init() { |
159 | - register_sidebar( array( |
|
160 | - 'name' => __( 'Widget Area', 'twentyfifteen' ), |
|
159 | + register_sidebar(array( |
|
160 | + 'name' => __('Widget Area', 'twentyfifteen'), |
|
161 | 161 | 'id' => 'sidebar-1', |
162 | - 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ), |
|
162 | + 'description' => __('Add widgets here to appear in your sidebar.', 'twentyfifteen'), |
|
163 | 163 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
164 | 164 | 'after_widget' => '</aside>', |
165 | 165 | 'before_title' => '<h2 class="widget-title">', |
166 | 166 | 'after_title' => '</h2>', |
167 | - ) ); |
|
167 | + )); |
|
168 | 168 | } |
169 | -add_action( 'widgets_init', 'twentyfifteen_widgets_init' ); |
|
169 | +add_action('widgets_init', 'twentyfifteen_widgets_init'); |
|
170 | 170 | |
171 | -if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : |
|
171 | +if ( ! function_exists('twentyfifteen_fonts_url')) : |
|
172 | 172 | /** |
173 | 173 | * Register Google fonts for Twenty Fifteen. |
174 | 174 | * |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * Translators: If there are characters in your language that are not supported |
186 | 186 | * by Noto Sans, translate this to 'off'. Do not translate into your own language. |
187 | 187 | */ |
188 | - if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { |
|
188 | + if ('off' !== _x('on', 'Noto Sans font: on or off', 'twentyfifteen')) { |
|
189 | 189 | $fonts[] = 'Noto Sans:400italic,700italic,400,700'; |
190 | 190 | } |
191 | 191 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * Translators: If there are characters in your language that are not supported |
194 | 194 | * by Noto Serif, translate this to 'off'. Do not translate into your own language. |
195 | 195 | */ |
196 | - if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { |
|
196 | + if ('off' !== _x('on', 'Noto Serif font: on or off', 'twentyfifteen')) { |
|
197 | 197 | $fonts[] = 'Noto Serif:400italic,700italic,400,700'; |
198 | 198 | } |
199 | 199 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * Translators: If there are characters in your language that are not supported |
202 | 202 | * by Inconsolata, translate this to 'off'. Do not translate into your own language. |
203 | 203 | */ |
204 | - if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { |
|
204 | + if ('off' !== _x('on', 'Inconsolata font: on or off', 'twentyfifteen')) { |
|
205 | 205 | $fonts[] = 'Inconsolata:400,700'; |
206 | 206 | } |
207 | 207 | |
@@ -209,23 +209,23 @@ discard block |
||
209 | 209 | * Translators: To add an additional character subset specific to your language, |
210 | 210 | * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. |
211 | 211 | */ |
212 | - $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); |
|
212 | + $subset = _x('no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen'); |
|
213 | 213 | |
214 | - if ( 'cyrillic' == $subset ) { |
|
214 | + if ('cyrillic' == $subset) { |
|
215 | 215 | $subsets .= ',cyrillic,cyrillic-ext'; |
216 | - } elseif ( 'greek' == $subset ) { |
|
216 | + } elseif ('greek' == $subset) { |
|
217 | 217 | $subsets .= ',greek,greek-ext'; |
218 | - } elseif ( 'devanagari' == $subset ) { |
|
218 | + } elseif ('devanagari' == $subset) { |
|
219 | 219 | $subsets .= ',devanagari'; |
220 | - } elseif ( 'vietnamese' == $subset ) { |
|
220 | + } elseif ('vietnamese' == $subset) { |
|
221 | 221 | $subsets .= ',vietnamese'; |
222 | 222 | } |
223 | 223 | |
224 | - if ( $fonts ) { |
|
225 | - $fonts_url = add_query_arg( array( |
|
226 | - 'family' => urlencode( implode( '|', $fonts ) ), |
|
227 | - 'subset' => urlencode( $subsets ), |
|
228 | - ), 'https://fonts.googleapis.com/css' ); |
|
224 | + if ($fonts) { |
|
225 | + $fonts_url = add_query_arg(array( |
|
226 | + 'family' => urlencode(implode('|', $fonts)), |
|
227 | + 'subset' => urlencode($subsets), |
|
228 | + ), 'https://fonts.googleapis.com/css'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | return $fonts_url; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | function twentyfifteen_javascript_detection() { |
243 | 243 | echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
244 | 244 | } |
245 | -add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 ); |
|
245 | +add_action('wp_head', 'twentyfifteen_javascript_detection', 0); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Enqueue scripts and styles. |
@@ -251,39 +251,39 @@ discard block |
||
251 | 251 | */ |
252 | 252 | function twentyfifteen_scripts() { |
253 | 253 | // Add custom fonts, used in the main stylesheet. |
254 | - wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); |
|
254 | + wp_enqueue_style('twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null); |
|
255 | 255 | |
256 | 256 | // Add Genericons, used in the main stylesheet. |
257 | - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' ); |
|
257 | + wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.2'); |
|
258 | 258 | |
259 | 259 | // Load our main stylesheet. |
260 | - wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() ); |
|
260 | + wp_enqueue_style('twentyfifteen-style', get_stylesheet_uri()); |
|
261 | 261 | |
262 | 262 | // Load the Internet Explorer specific stylesheet. |
263 | - wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' ); |
|
264 | - wp_style_add_data( 'twentyfifteen-ie', 'conditional', 'lt IE 9' ); |
|
263 | + wp_enqueue_style('twentyfifteen-ie', get_template_directory_uri().'/css/ie.css', array('twentyfifteen-style'), '20141010'); |
|
264 | + wp_style_add_data('twentyfifteen-ie', 'conditional', 'lt IE 9'); |
|
265 | 265 | |
266 | 266 | // Load the Internet Explorer 7 specific stylesheet. |
267 | - wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' ); |
|
268 | - wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' ); |
|
267 | + wp_enqueue_style('twentyfifteen-ie7', get_template_directory_uri().'/css/ie7.css', array('twentyfifteen-style'), '20141010'); |
|
268 | + wp_style_add_data('twentyfifteen-ie7', 'conditional', 'lt IE 8'); |
|
269 | 269 | |
270 | - wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true ); |
|
270 | + wp_enqueue_script('twentyfifteen-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20141010', true); |
|
271 | 271 | |
272 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
273 | - wp_enqueue_script( 'comment-reply' ); |
|
272 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
273 | + wp_enqueue_script('comment-reply'); |
|
274 | 274 | } |
275 | 275 | |
276 | - if ( is_singular() && wp_attachment_is_image() ) { |
|
277 | - wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' ); |
|
276 | + if (is_singular() && wp_attachment_is_image()) { |
|
277 | + wp_enqueue_script('twentyfifteen-keyboard-image-navigation', get_template_directory_uri().'/js/keyboard-image-navigation.js', array('jquery'), '20141010'); |
|
278 | 278 | } |
279 | 279 | |
280 | - wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true ); |
|
281 | - wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array( |
|
282 | - 'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>', |
|
283 | - 'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>', |
|
284 | - ) ); |
|
280 | + wp_enqueue_script('twentyfifteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20150330', true); |
|
281 | + wp_localize_script('twentyfifteen-script', 'screenReaderText', array( |
|
282 | + 'expand' => '<span class="screen-reader-text">'.__('expand child menu', 'twentyfifteen').'</span>', |
|
283 | + 'collapse' => '<span class="screen-reader-text">'.__('collapse child menu', 'twentyfifteen').'</span>', |
|
284 | + )); |
|
285 | 285 | } |
286 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); |
|
286 | +add_action('wp_enqueue_scripts', 'twentyfifteen_scripts'); |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Add preconnect for Google Fonts. |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | * @param string $relation_type The relation type the URLs are printed. |
295 | 295 | * @return array URLs to print for resource hints. |
296 | 296 | */ |
297 | -function twentyfifteen_resource_hints( $urls, $relation_type ) { |
|
298 | - if ( wp_style_is( 'twentyfifteen-fonts', 'queue' ) && 'preconnect' === $relation_type ) { |
|
299 | - if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { |
|
297 | +function twentyfifteen_resource_hints($urls, $relation_type) { |
|
298 | + if (wp_style_is('twentyfifteen-fonts', 'queue') && 'preconnect' === $relation_type) { |
|
299 | + if (version_compare($GLOBALS['wp_version'], '4.7-alpha', '>=')) { |
|
300 | 300 | $urls[] = array( |
301 | 301 | 'href' => 'https://fonts.gstatic.com', |
302 | 302 | 'crossorigin', |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | |
309 | 309 | return $urls; |
310 | 310 | } |
311 | -add_filter( 'wp_resource_hints', 'twentyfifteen_resource_hints', 10, 2 ); |
|
311 | +add_filter('wp_resource_hints', 'twentyfifteen_resource_hints', 10, 2); |
|
312 | 312 | |
313 | 313 | /** |
314 | 314 | * Add featured image as background image to post navigation elements. |
@@ -318,39 +318,39 @@ discard block |
||
318 | 318 | * @see wp_add_inline_style() |
319 | 319 | */ |
320 | 320 | function twentyfifteen_post_nav_background() { |
321 | - if ( ! is_single() ) { |
|
321 | + if ( ! is_single()) { |
|
322 | 322 | return; |
323 | 323 | } |
324 | 324 | |
325 | - $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); |
|
326 | - $next = get_adjacent_post( false, '', false ); |
|
325 | + $previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); |
|
326 | + $next = get_adjacent_post(false, '', false); |
|
327 | 327 | $css = ''; |
328 | 328 | |
329 | - if ( is_attachment() && 'attachment' == $previous->post_type ) { |
|
329 | + if (is_attachment() && 'attachment' == $previous->post_type) { |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | |
333 | - if ( $previous && has_post_thumbnail( $previous->ID ) ) { |
|
334 | - $prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' ); |
|
333 | + if ($previous && has_post_thumbnail($previous->ID)) { |
|
334 | + $prevthumb = wp_get_attachment_image_src(get_post_thumbnail_id($previous->ID), 'post-thumbnail'); |
|
335 | 335 | $css .= ' |
336 | - .post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); } |
|
336 | + .post-navigation .nav-previous { background-image: url(' . esc_url($prevthumb[0]).'); } |
|
337 | 337 | .post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; } |
338 | 338 | .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); } |
339 | 339 | '; |
340 | 340 | } |
341 | 341 | |
342 | - if ( $next && has_post_thumbnail( $next->ID ) ) { |
|
343 | - $nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' ); |
|
342 | + if ($next && has_post_thumbnail($next->ID)) { |
|
343 | + $nextthumb = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'post-thumbnail'); |
|
344 | 344 | $css .= ' |
345 | - .post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); border-top: 0; } |
|
345 | + .post-navigation .nav-next { background-image: url(' . esc_url($nextthumb[0]).'); border-top: 0; } |
|
346 | 346 | .post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; } |
347 | 347 | .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); } |
348 | 348 | '; |
349 | 349 | } |
350 | 350 | |
351 | - wp_add_inline_style( 'twentyfifteen-style', $css ); |
|
351 | + wp_add_inline_style('twentyfifteen-style', $css); |
|
352 | 352 | } |
353 | -add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' ); |
|
353 | +add_action('wp_enqueue_scripts', 'twentyfifteen_post_nav_background'); |
|
354 | 354 | |
355 | 355 | /** |
356 | 356 | * Display descriptions in main navigation. |
@@ -363,14 +363,14 @@ discard block |
||
363 | 363 | * @param array $args wp_nav_menu() arguments. |
364 | 364 | * @return string Menu item with possible description. |
365 | 365 | */ |
366 | -function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) { |
|
367 | - if ( 'primary' == $args->theme_location && $item->description ) { |
|
368 | - $item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output ); |
|
366 | +function twentyfifteen_nav_description($item_output, $item, $depth, $args) { |
|
367 | + if ('primary' == $args->theme_location && $item->description) { |
|
368 | + $item_output = str_replace($args->link_after.'</a>', '<div class="menu-item-description">'.$item->description.'</div>'.$args->link_after.'</a>', $item_output); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | return $item_output; |
372 | 372 | } |
373 | -add_filter( 'walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4 ); |
|
373 | +add_filter('walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4); |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * Add a `screen-reader-text` class to the search form's submit button. |
@@ -380,28 +380,28 @@ discard block |
||
380 | 380 | * @param string $html Search form HTML. |
381 | 381 | * @return string Modified search form HTML. |
382 | 382 | */ |
383 | -function twentyfifteen_search_form_modify( $html ) { |
|
384 | - return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html ); |
|
383 | +function twentyfifteen_search_form_modify($html) { |
|
384 | + return str_replace('class="search-submit"', 'class="search-submit screen-reader-text"', $html); |
|
385 | 385 | } |
386 | -add_filter( 'get_search_form', 'twentyfifteen_search_form_modify' ); |
|
386 | +add_filter('get_search_form', 'twentyfifteen_search_form_modify'); |
|
387 | 387 | |
388 | 388 | /** |
389 | 389 | * Implement the Custom Header feature. |
390 | 390 | * |
391 | 391 | * @since Twenty Fifteen 1.0 |
392 | 392 | */ |
393 | -require get_template_directory() . '/inc/custom-header.php'; |
|
393 | +require get_template_directory().'/inc/custom-header.php'; |
|
394 | 394 | |
395 | 395 | /** |
396 | 396 | * Custom template tags for this theme. |
397 | 397 | * |
398 | 398 | * @since Twenty Fifteen 1.0 |
399 | 399 | */ |
400 | -require get_template_directory() . '/inc/template-tags.php'; |
|
400 | +require get_template_directory().'/inc/template-tags.php'; |
|
401 | 401 | |
402 | 402 | /** |
403 | 403 | * Customizer additions. |
404 | 404 | * |
405 | 405 | * @since Twenty Fifteen 1.0 |
406 | 406 | */ |
407 | -require get_template_directory() . '/inc/customizer.php'; |
|
407 | +require get_template_directory().'/inc/customizer.php'; |