@@ -12,51 +12,51 @@ |
||
12 | 12 | <?php twentyfourteen_post_thumbnail(); ?> |
13 | 13 | |
14 | 14 | <header class="entry-header"> |
15 | - <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?> |
|
15 | + <?php if (in_array('category', get_object_taxonomies(get_post_type())) && twentyfourteen_categorized_blog()) : ?> |
|
16 | 16 | <div class="entry-meta"> |
17 | - <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span> |
|
17 | + <span class="cat-links"><?php echo get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen')); ?></span> |
|
18 | 18 | </div><!-- .entry-meta --> |
19 | 19 | <?php |
20 | 20 | endif; |
21 | 21 | |
22 | - if ( is_single() ) : |
|
23 | - the_title( '<h1 class="entry-title">', '</h1>' ); |
|
22 | + if (is_single()) : |
|
23 | + the_title('<h1 class="entry-title">', '</h1>'); |
|
24 | 24 | else : |
25 | - the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); |
|
25 | + the_title('<h1 class="entry-title"><a href="'.esc_url(get_permalink()).'" rel="bookmark">', '</a></h1>'); |
|
26 | 26 | endif; |
27 | 27 | ?> |
28 | 28 | |
29 | 29 | <div class="entry-meta"> |
30 | 30 | <span class="post-format"> |
31 | - <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'image' ) ); ?>"><?php echo get_post_format_string( 'image' ); ?></a> |
|
31 | + <a class="entry-format" href="<?php echo esc_url(get_post_format_link('image')); ?>"><?php echo get_post_format_string('image'); ?></a> |
|
32 | 32 | </span> |
33 | 33 | |
34 | 34 | <?php twentyfourteen_posted_on(); ?> |
35 | 35 | |
36 | - <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?> |
|
37 | - <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span> |
|
36 | + <?php if ( ! post_password_required() && (comments_open() || get_comments_number())) : ?> |
|
37 | + <span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'twentyfourteen'), __('1 Comment', 'twentyfourteen'), __('% Comments', 'twentyfourteen')); ?></span> |
|
38 | 38 | <?php endif; ?> |
39 | 39 | |
40 | - <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?> |
|
40 | + <?php edit_post_link(__('Edit', 'twentyfourteen'), '<span class="edit-link">', '</span>'); ?> |
|
41 | 41 | </div><!-- .entry-meta --> |
42 | 42 | </header><!-- .entry-header --> |
43 | 43 | |
44 | 44 | <div class="entry-content"> |
45 | 45 | <?php |
46 | 46 | /* translators: %s: Name of current post */ |
47 | - the_content( sprintf( |
|
48 | - __( 'Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen' ), |
|
49 | - the_title( '<span class="screen-reader-text">', '</span>', false ) |
|
50 | - ) ); |
|
47 | + the_content(sprintf( |
|
48 | + __('Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen'), |
|
49 | + the_title('<span class="screen-reader-text">', '</span>', false) |
|
50 | + )); |
|
51 | 51 | |
52 | - wp_link_pages( array( |
|
53 | - 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', |
|
52 | + wp_link_pages(array( |
|
53 | + 'before' => '<div class="page-links"><span class="page-links-title">'.__('Pages:', 'twentyfourteen').'</span>', |
|
54 | 54 | 'after' => '</div>', |
55 | 55 | 'link_before' => '<span>', |
56 | 56 | 'link_after' => '</span>', |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | ?> |
59 | 59 | </div><!-- .entry-content --> |
60 | 60 | |
61 | - <?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?> |
|
61 | + <?php the_tags('<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>'); ?> |
|
62 | 62 | </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 |
@@ -12,22 +12,22 @@ discard block |
||
12 | 12 | <section id="primary" class="content-area"> |
13 | 13 | <div id="content" class="site-content" role="main"> |
14 | 14 | |
15 | - <?php if ( have_posts() ) : ?> |
|
15 | + <?php if (have_posts()) : ?> |
|
16 | 16 | |
17 | 17 | <header class="page-header"> |
18 | - <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1> |
|
18 | + <h1 class="page-title"><?php printf(__('Search Results for: %s', 'twentyfourteen'), get_search_query()); ?></h1> |
|
19 | 19 | </header><!-- .page-header --> |
20 | 20 | |
21 | 21 | <?php |
22 | 22 | // Start the Loop. |
23 | - while ( have_posts() ) : the_post(); |
|
23 | + while (have_posts()) : the_post(); |
|
24 | 24 | |
25 | 25 | /* |
26 | 26 | * Include the post format-specific template for the content. If you want to |
27 | 27 | * use this in a child theme, then include a file called called content-___.php |
28 | 28 | * (where ___ is the post format) and that will be used instead. |
29 | 29 | */ |
30 | - get_template_part( 'content', get_post_format() ); |
|
30 | + get_template_part('content', get_post_format()); |
|
31 | 31 | |
32 | 32 | endwhile; |
33 | 33 | // Previous/next post navigation. |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | else : |
37 | 37 | // If no content, include the "No posts found" template. |
38 | - get_template_part( 'content', 'none' ); |
|
38 | + get_template_part('content', 'none'); |
|
39 | 39 | |
40 | 40 | endif; |
41 | 41 | ?> |
@@ -44,6 +44,6 @@ discard block |
||
44 | 44 | </section><!-- #primary --> |
45 | 45 | |
46 | 46 | <?php |
47 | -get_sidebar( 'content' ); |
|
47 | +get_sidebar('content'); |
|
48 | 48 | get_sidebar(); |
49 | 49 | get_footer(); |
@@ -33,9 +33,11 @@ |
||
33 | 33 | // Previous/next post navigation. |
34 | 34 | twentyfourteen_paging_nav(); |
35 | 35 | |
36 | - else : |
|
36 | + else { |
|
37 | + : |
|
37 | 38 | // If no content, include the "No posts found" template. |
38 | 39 | get_template_part( 'content', 'none' ); |
40 | + } |
|
39 | 41 | |
40 | 42 | endif; |
41 | 43 | ?> |
@@ -7,13 +7,13 @@ |
||
7 | 7 | * @since Twenty Fourteen 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! is_active_sidebar( 'sidebar-3' ) ) { |
|
10 | +if ( ! is_active_sidebar('sidebar-3')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | |
15 | 15 | <div id="supplementary"> |
16 | 16 | <div id="footer-sidebar" class="footer-sidebar widget-area" role="complementary"> |
17 | - <?php dynamic_sidebar( 'sidebar-3' ); ?> |
|
17 | + <?php dynamic_sidebar('sidebar-3'); ?> |
|
18 | 18 | </div><!-- #footer-sidebar --> |
19 | 19 | </div><!-- #supplementary --> |
@@ -21,34 +21,34 @@ discard block |
||
21 | 21 | <section id="primary" class="content-area"> |
22 | 22 | <div id="content" class="site-content" role="main"> |
23 | 23 | |
24 | - <?php if ( have_posts() ) : ?> |
|
24 | + <?php if (have_posts()) : ?> |
|
25 | 25 | |
26 | 26 | <header class="archive-header"> |
27 | 27 | <h1 class="archive-title"> |
28 | 28 | <?php |
29 | - if ( is_tax( 'post_format', 'post-format-aside' ) ) : |
|
30 | - _e( 'Asides', 'twentyfourteen' ); |
|
29 | + if (is_tax('post_format', 'post-format-aside')) : |
|
30 | + _e('Asides', 'twentyfourteen'); |
|
31 | 31 | |
32 | - elseif ( is_tax( 'post_format', 'post-format-image' ) ) : |
|
33 | - _e( 'Images', 'twentyfourteen' ); |
|
32 | + elseif (is_tax('post_format', 'post-format-image')) : |
|
33 | + _e('Images', 'twentyfourteen'); |
|
34 | 34 | |
35 | - elseif ( is_tax( 'post_format', 'post-format-video' ) ) : |
|
36 | - _e( 'Videos', 'twentyfourteen' ); |
|
35 | + elseif (is_tax('post_format', 'post-format-video')) : |
|
36 | + _e('Videos', 'twentyfourteen'); |
|
37 | 37 | |
38 | - elseif ( is_tax( 'post_format', 'post-format-audio' ) ) : |
|
39 | - _e( 'Audio', 'twentyfourteen' ); |
|
38 | + elseif (is_tax('post_format', 'post-format-audio')) : |
|
39 | + _e('Audio', 'twentyfourteen'); |
|
40 | 40 | |
41 | - elseif ( is_tax( 'post_format', 'post-format-quote' ) ) : |
|
42 | - _e( 'Quotes', 'twentyfourteen' ); |
|
41 | + elseif (is_tax('post_format', 'post-format-quote')) : |
|
42 | + _e('Quotes', 'twentyfourteen'); |
|
43 | 43 | |
44 | - elseif ( is_tax( 'post_format', 'post-format-link' ) ) : |
|
45 | - _e( 'Links', 'twentyfourteen' ); |
|
44 | + elseif (is_tax('post_format', 'post-format-link')) : |
|
45 | + _e('Links', 'twentyfourteen'); |
|
46 | 46 | |
47 | - elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) : |
|
48 | - _e( 'Galleries', 'twentyfourteen' ); |
|
47 | + elseif (is_tax('post_format', 'post-format-gallery')) : |
|
48 | + _e('Galleries', 'twentyfourteen'); |
|
49 | 49 | |
50 | 50 | else : |
51 | - _e( 'Archives', 'twentyfourteen' ); |
|
51 | + _e('Archives', 'twentyfourteen'); |
|
52 | 52 | |
53 | 53 | endif; |
54 | 54 | ?> |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | |
58 | 58 | <?php |
59 | 59 | // Start the Loop. |
60 | - while ( have_posts() ) : the_post(); |
|
60 | + while (have_posts()) : the_post(); |
|
61 | 61 | |
62 | 62 | /* |
63 | 63 | * Include the post format-specific template for the content. If you want to |
64 | 64 | * use this in a child theme, then include a file called called content-___.php |
65 | 65 | * (where ___ is the post format) and that will be used instead. |
66 | 66 | */ |
67 | - get_template_part( 'content', get_post_format() ); |
|
67 | + get_template_part('content', get_post_format()); |
|
68 | 68 | |
69 | 69 | endwhile; |
70 | 70 | // Previous/next page navigation. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | else : |
74 | 74 | // If no content, include the "No posts found" template. |
75 | - get_template_part( 'content', 'none' ); |
|
75 | + get_template_part('content', 'none'); |
|
76 | 76 | |
77 | 77 | endif; |
78 | 78 | ?> |
@@ -80,6 +80,6 @@ discard block |
||
80 | 80 | </section><!-- #primary --> |
81 | 81 | |
82 | 82 | <?php |
83 | -get_sidebar( 'content' ); |
|
83 | +get_sidebar('content'); |
|
84 | 84 | get_sidebar(); |
85 | 85 | get_footer(); |
@@ -47,8 +47,10 @@ discard block |
||
47 | 47 | elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) : |
48 | 48 | _e( 'Galleries', 'twentyfourteen' ); |
49 | 49 | |
50 | - else : |
|
50 | + else { |
|
51 | + : |
|
51 | 52 | _e( 'Archives', 'twentyfourteen' ); |
53 | + } |
|
52 | 54 | |
53 | 55 | endif; |
54 | 56 | ?> |
@@ -70,9 +72,11 @@ discard block |
||
70 | 72 | // Previous/next page navigation. |
71 | 73 | twentyfourteen_paging_nav(); |
72 | 74 | |
73 | - else : |
|
75 | + else { |
|
76 | + : |
|
74 | 77 | // If no content, include the "No posts found" template. |
75 | 78 | get_template_part( 'content', 'none' ); |
79 | + } |
|
76 | 80 | |
77 | 81 | endif; |
78 | 82 | ?> |
@@ -16,30 +16,30 @@ discard block |
||
16 | 16 | <section id="primary" class="content-area"> |
17 | 17 | <div id="content" class="site-content" role="main"> |
18 | 18 | |
19 | - <?php if ( have_posts() ) : ?> |
|
19 | + <?php if (have_posts()) : ?> |
|
20 | 20 | |
21 | 21 | <header class="archive-header"> |
22 | - <h1 class="archive-title"><?php printf( __( 'Tag Archives: %s', 'twentyfourteen' ), single_tag_title( '', false ) ); ?></h1> |
|
22 | + <h1 class="archive-title"><?php printf(__('Tag Archives: %s', 'twentyfourteen'), single_tag_title('', false)); ?></h1> |
|
23 | 23 | |
24 | 24 | <?php |
25 | 25 | // Show an optional term description. |
26 | 26 | $term_description = term_description(); |
27 | - if ( ! empty( $term_description ) ) : |
|
28 | - printf( '<div class="taxonomy-description">%s</div>', $term_description ); |
|
27 | + if ( ! empty($term_description)) : |
|
28 | + printf('<div class="taxonomy-description">%s</div>', $term_description); |
|
29 | 29 | endif; |
30 | 30 | ?> |
31 | 31 | </header><!-- .archive-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. If you want to |
39 | 39 | * use this in a child theme, then include a file called called content-___.php |
40 | 40 | * (where ___ is the post format) 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 | endwhile; |
45 | 45 | // Previous/next page navigation. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | else : |
49 | 49 | // If no content, include the "No posts found" template. |
50 | - get_template_part( 'content', 'none' ); |
|
50 | + get_template_part('content', 'none'); |
|
51 | 51 | |
52 | 52 | endif; |
53 | 53 | ?> |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | </section><!-- #primary --> |
56 | 56 | |
57 | 57 | <?php |
58 | -get_sidebar( 'content' ); |
|
58 | +get_sidebar('content'); |
|
59 | 59 | get_sidebar(); |
60 | 60 | get_footer(); |
@@ -43,9 +43,11 @@ |
||
43 | 43 | // Previous/next page navigation. |
44 | 44 | twentyfourteen_paging_nav(); |
45 | 45 | |
46 | - else : |
|
46 | + else { |
|
47 | + : |
|
47 | 48 | // If no content, include the "No posts found" template. |
48 | 49 | get_template_part( 'content', 'none' ); |
50 | + } |
|
49 | 51 | |
50 | 52 | endif; |
51 | 53 | ?> |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | * @since Twenty Fourteen 1.0 |
20 | 20 | */ |
21 | 21 | function twentyfourteen_switch_theme() { |
22 | - switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); |
|
23 | - unset( $_GET['activated'] ); |
|
24 | - add_action( 'admin_notices', 'twentyfourteen_upgrade_notice' ); |
|
22 | + switch_theme(WP_DEFAULT_THEME, WP_DEFAULT_THEME); |
|
23 | + unset($_GET['activated']); |
|
24 | + add_action('admin_notices', 'twentyfourteen_upgrade_notice'); |
|
25 | 25 | } |
26 | -add_action( 'after_switch_theme', 'twentyfourteen_switch_theme' ); |
|
26 | +add_action('after_switch_theme', 'twentyfourteen_switch_theme'); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Add message for unsuccessful theme switch. |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @since Twenty Fourteen 1.0 |
35 | 35 | */ |
36 | 36 | function twentyfourteen_upgrade_notice() { |
37 | - $message = sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ); |
|
38 | - printf( '<div class="error"><p>%s</p></div>', $message ); |
|
37 | + $message = sprintf(__('Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen'), $GLOBALS['wp_version']); |
|
38 | + printf('<div class="error"><p>%s</p></div>', $message); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * @since Twenty Fourteen 1.0 |
45 | 45 | */ |
46 | 46 | function twentyfourteen_customize() { |
47 | - wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ), '', array( |
|
47 | + wp_die(sprintf(__('Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen'), $GLOBALS['wp_version']), '', array( |
|
48 | 48 | 'back_link' => true, |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | } |
51 | -add_action( 'load-customize.php', 'twentyfourteen_customize' ); |
|
51 | +add_action('load-customize.php', 'twentyfourteen_customize'); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4. |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @since Twenty Fourteen 1.0 |
57 | 57 | */ |
58 | 58 | function twentyfourteen_preview() { |
59 | - if ( isset( $_GET['preview'] ) ) { |
|
60 | - wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ) ); |
|
59 | + if (isset($_GET['preview'])) { |
|
60 | + wp_die(sprintf(__('Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen'), $GLOBALS['wp_version'])); |
|
61 | 61 | } |
62 | 62 | } |
63 | -add_action( 'template_redirect', 'twentyfourteen_preview' ); |
|
63 | +add_action('template_redirect', 'twentyfourteen_preview'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * the Appearance > Header screen. |
36 | 36 | * } |
37 | 37 | */ |
38 | - add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array( |
|
38 | + add_theme_support('custom-header', apply_filters('twentyfourteen_custom_header_args', array( |
|
39 | 39 | 'default-text-color' => 'fff', |
40 | 40 | 'width' => 1260, |
41 | 41 | 'height' => 240, |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | 'wp-head-callback' => 'twentyfourteen_header_style', |
44 | 44 | 'admin-head-callback' => 'twentyfourteen_admin_header_style', |
45 | 45 | 'admin-preview-callback' => 'twentyfourteen_admin_header_image', |
46 | - ) ) ); |
|
46 | + ))); |
|
47 | 47 | } |
48 | -add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' ); |
|
48 | +add_action('after_setup_theme', 'twentyfourteen_custom_header_setup'); |
|
49 | 49 | |
50 | -if ( ! function_exists( 'twentyfourteen_header_style' ) ) : |
|
50 | +if ( ! function_exists('twentyfourteen_header_style')) : |
|
51 | 51 | /** |
52 | 52 | * Styles the header image and text displayed on the blog |
53 | 53 | * |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $text_color = get_header_textcolor(); |
59 | 59 | |
60 | 60 | // If no custom color for text is set, let's bail. |
61 | - if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) ) |
|
61 | + if (display_header_text() && $text_color === get_theme_support('custom-header', 'default-text-color')) |
|
62 | 62 | return; |
63 | 63 | |
64 | 64 | // If we get this far, we have custom styles. |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <style type="text/css" id="twentyfourteen-header-css"> |
67 | 67 | <?php |
68 | 68 | // Has the text been hidden? |
69 | - if ( ! display_header_text() ) : |
|
69 | + if ( ! display_header_text()) : |
|
70 | 70 | ?> |
71 | 71 | .site-title, |
72 | 72 | .site-description { |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | } |
77 | 77 | <?php |
78 | 78 | // If the user has set a custom color for the text, use that. |
79 | - elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) : |
|
79 | + elseif ($text_color != get_theme_support('custom-header', 'default-text-color')) : |
|
80 | 80 | ?> |
81 | 81 | .site-title a { |
82 | - color: #<?php echo esc_attr( $text_color ); ?>; |
|
82 | + color: #<?php echo esc_attr($text_color); ?>; |
|
83 | 83 | } |
84 | 84 | <?php endif; ?> |
85 | 85 | </style> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | endif; // twentyfourteen_header_style |
89 | 89 | |
90 | 90 | |
91 | -if ( ! function_exists( 'twentyfourteen_admin_header_style' ) ) : |
|
91 | +if ( ! function_exists('twentyfourteen_admin_header_style')) : |
|
92 | 92 | /** |
93 | 93 | * Style the header image displayed on the Appearance > Header screen. |
94 | 94 | * |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | endif; // twentyfourteen_admin_header_style |
128 | 128 | |
129 | -if ( ! function_exists( 'twentyfourteen_admin_header_image' ) ) : |
|
129 | +if ( ! function_exists('twentyfourteen_admin_header_image')) : |
|
130 | 130 | /** |
131 | 131 | * Create the custom header image markup displayed on the Appearance > Header screen. |
132 | 132 | * |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | function twentyfourteen_admin_header_image() { |
138 | 138 | ?> |
139 | 139 | <div id="headimg"> |
140 | - <?php if ( get_header_image() ) : ?> |
|
140 | + <?php if (get_header_image()) : ?> |
|
141 | 141 | <img src="<?php header_image(); ?>" alt=""> |
142 | 142 | <?php endif; ?> |
143 | - <h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( sprintf( 'color: #%s;', get_header_textcolor() ) ); ?>" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1> |
|
143 | + <h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr(sprintf('color: #%s;', get_header_textcolor())); ?>" onclick="return false;" href="<?php echo esc_url(home_url('/')); ?>" tabindex="-1"><?php bloginfo('name'); ?></a></h1> |
|
144 | 144 | </div> |
145 | 145 | <?php |
146 | 146 | } |
@@ -58,8 +58,9 @@ |
||
58 | 58 | $text_color = get_header_textcolor(); |
59 | 59 | |
60 | 60 | // If no custom color for text is set, let's bail. |
61 | - if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) ) |
|
62 | - return; |
|
61 | + if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) ) { |
|
62 | + return; |
|
63 | + } |
|
63 | 64 | |
64 | 65 | // If we get this far, we have custom styles. |
65 | 66 | ?> |
@@ -87,8 +87,10 @@ discard block |
||
87 | 87 | <?php |
88 | 88 | if ( is_attachment() ) : |
89 | 89 | previous_post_link( '%link', __( '<span class="meta-nav">Published In</span>%title', 'twentyfourteen' ) ); |
90 | - else : |
|
90 | + else { |
|
91 | + : |
|
91 | 92 | previous_post_link( '%link', __( '<span class="meta-nav">Previous Post</span>%title', 'twentyfourteen' ) ); |
93 | + } |
|
92 | 94 | next_post_link( '%link', __( '<span class="meta-nav">Next Post</span>%title', 'twentyfourteen' ) ); |
93 | 95 | endif; |
94 | 96 | ?> |
@@ -189,9 +191,12 @@ discard block |
||
189 | 191 | ?> |
190 | 192 | </div> |
191 | 193 | |
192 | - <?php else : ?> |
|
194 | + <?php else { |
|
195 | + : ?> |
|
193 | 196 | |
194 | - <a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true"> |
|
197 | + <a class="post-thumbnail" href="<?php the_permalink(); |
|
198 | +} |
|
199 | +?>" aria-hidden="true"> |
|
195 | 200 | <?php |
196 | 201 | if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) ) { |
197 | 202 | the_post_thumbnail( 'twentyfourteen-full-width' ); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since Twenty Fourteen 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) : |
|
10 | +if ( ! function_exists('twentyfourteen_paging_nav')) : |
|
11 | 11 | /** |
12 | 12 | * Display navigation to next/previous set of posts when applicable. |
13 | 13 | * |
@@ -20,42 +20,42 @@ discard block |
||
20 | 20 | global $wp_query, $wp_rewrite; |
21 | 21 | |
22 | 22 | // Don't print empty markup if there's only one page. |
23 | - if ( $wp_query->max_num_pages < 2 ) { |
|
23 | + if ($wp_query->max_num_pages < 2) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; |
|
28 | - $pagenum_link = html_entity_decode( get_pagenum_link() ); |
|
27 | + $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; |
|
28 | + $pagenum_link = html_entity_decode(get_pagenum_link()); |
|
29 | 29 | $query_args = array(); |
30 | - $url_parts = explode( '?', $pagenum_link ); |
|
30 | + $url_parts = explode('?', $pagenum_link); |
|
31 | 31 | |
32 | - if ( isset( $url_parts[1] ) ) { |
|
33 | - wp_parse_str( $url_parts[1], $query_args ); |
|
32 | + if (isset($url_parts[1])) { |
|
33 | + wp_parse_str($url_parts[1], $query_args); |
|
34 | 34 | } |
35 | 35 | |
36 | - $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); |
|
37 | - $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; |
|
36 | + $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); |
|
37 | + $pagenum_link = trailingslashit($pagenum_link).'%_%'; |
|
38 | 38 | |
39 | - $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; |
|
40 | - $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%'; |
|
39 | + $format = $wp_rewrite->using_index_permalinks() && ! strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; |
|
40 | + $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base.'/%#%', 'paged') : '?paged=%#%'; |
|
41 | 41 | |
42 | 42 | // Set up paginated links. |
43 | - $links = paginate_links( array( |
|
43 | + $links = paginate_links(array( |
|
44 | 44 | 'base' => $pagenum_link, |
45 | 45 | 'format' => $format, |
46 | 46 | 'total' => $wp_query->max_num_pages, |
47 | 47 | 'current' => $paged, |
48 | 48 | 'mid_size' => 1, |
49 | - 'add_args' => array_map( 'urlencode', $query_args ), |
|
50 | - 'prev_text' => __( '← Previous', 'twentyfourteen' ), |
|
51 | - 'next_text' => __( 'Next →', 'twentyfourteen' ), |
|
52 | - ) ); |
|
49 | + 'add_args' => array_map('urlencode', $query_args), |
|
50 | + 'prev_text' => __('← Previous', 'twentyfourteen'), |
|
51 | + 'next_text' => __('Next →', 'twentyfourteen'), |
|
52 | + )); |
|
53 | 53 | |
54 | - if ( $links ) : |
|
54 | + if ($links) : |
|
55 | 55 | |
56 | 56 | ?> |
57 | 57 | <nav class="navigation paging-navigation" role="navigation"> |
58 | - <h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentyfourteen' ); ?></h1> |
|
58 | + <h1 class="screen-reader-text"><?php _e('Posts navigation', 'twentyfourteen'); ?></h1> |
|
59 | 59 | <div class="pagination loop-pagination"> |
60 | 60 | <?php echo $links; ?> |
61 | 61 | </div><!-- .pagination --> |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | endif; |
67 | 67 | |
68 | -if ( ! function_exists( 'twentyfourteen_post_nav' ) ) : |
|
68 | +if ( ! function_exists('twentyfourteen_post_nav')) : |
|
69 | 69 | /** |
70 | 70 | * Display navigation to next/previous post when applicable. |
71 | 71 | * |
@@ -73,23 +73,23 @@ discard block |
||
73 | 73 | */ |
74 | 74 | function twentyfourteen_post_nav() { |
75 | 75 | // Don't print empty markup if there's nowhere to navigate. |
76 | - $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); |
|
77 | - $next = get_adjacent_post( false, '', false ); |
|
76 | + $previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); |
|
77 | + $next = get_adjacent_post(false, '', false); |
|
78 | 78 | |
79 | - if ( ! $next && ! $previous ) { |
|
79 | + if ( ! $next && ! $previous) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | ?> |
84 | 84 | <nav class="navigation post-navigation" role="navigation"> |
85 | - <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentyfourteen' ); ?></h1> |
|
85 | + <h1 class="screen-reader-text"><?php _e('Post navigation', 'twentyfourteen'); ?></h1> |
|
86 | 86 | <div class="nav-links"> |
87 | 87 | <?php |
88 | - if ( is_attachment() ) : |
|
89 | - previous_post_link( '%link', __( '<span class="meta-nav">Published In</span>%title', 'twentyfourteen' ) ); |
|
88 | + if (is_attachment()) : |
|
89 | + previous_post_link('%link', __('<span class="meta-nav">Published In</span>%title', 'twentyfourteen')); |
|
90 | 90 | else : |
91 | - previous_post_link( '%link', __( '<span class="meta-nav">Previous Post</span>%title', 'twentyfourteen' ) ); |
|
92 | - next_post_link( '%link', __( '<span class="meta-nav">Next Post</span>%title', 'twentyfourteen' ) ); |
|
91 | + previous_post_link('%link', __('<span class="meta-nav">Previous Post</span>%title', 'twentyfourteen')); |
|
92 | + next_post_link('%link', __('<span class="meta-nav">Next Post</span>%title', 'twentyfourteen')); |
|
93 | 93 | endif; |
94 | 94 | ?> |
95 | 95 | </div><!-- .nav-links --> |
@@ -98,23 +98,23 @@ discard block |
||
98 | 98 | } |
99 | 99 | endif; |
100 | 100 | |
101 | -if ( ! function_exists( 'twentyfourteen_posted_on' ) ) : |
|
101 | +if ( ! function_exists('twentyfourteen_posted_on')) : |
|
102 | 102 | /** |
103 | 103 | * Print HTML with meta information for the current post-date/time and author. |
104 | 104 | * |
105 | 105 | * @since Twenty Fourteen 1.0 |
106 | 106 | */ |
107 | 107 | function twentyfourteen_posted_on() { |
108 | - if ( is_sticky() && is_home() && ! is_paged() ) { |
|
109 | - echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>'; |
|
108 | + if (is_sticky() && is_home() && ! is_paged()) { |
|
109 | + echo '<span class="featured-post">'.__('Sticky', 'twentyfourteen').'</span>'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Set up and print post meta information. |
113 | - printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', |
|
114 | - esc_url( get_permalink() ), |
|
115 | - esc_attr( get_the_date( 'c' ) ), |
|
116 | - esc_html( get_the_date() ), |
|
117 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
113 | + printf('<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', |
|
114 | + esc_url(get_permalink()), |
|
115 | + esc_attr(get_the_date('c')), |
|
116 | + esc_html(get_the_date()), |
|
117 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
118 | 118 | get_the_author() |
119 | 119 | ); |
120 | 120 | } |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | * @return boolean true if blog has more than 1 category |
129 | 129 | */ |
130 | 130 | function twentyfourteen_categorized_blog() { |
131 | - if ( false === ( $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ) ) ) { |
|
131 | + if (false === ($all_the_cool_cats = get_transient('twentyfourteen_category_count'))) { |
|
132 | 132 | // Create an array of all the categories that are attached to posts |
133 | - $all_the_cool_cats = get_categories( array( |
|
133 | + $all_the_cool_cats = get_categories(array( |
|
134 | 134 | 'hide_empty' => 1, |
135 | - ) ); |
|
135 | + )); |
|
136 | 136 | |
137 | 137 | // Count the number of categories that are attached to the posts |
138 | - $all_the_cool_cats = count( $all_the_cool_cats ); |
|
138 | + $all_the_cool_cats = count($all_the_cool_cats); |
|
139 | 139 | |
140 | - set_transient( 'twentyfourteen_category_count', $all_the_cool_cats ); |
|
140 | + set_transient('twentyfourteen_category_count', $all_the_cool_cats); |
|
141 | 141 | } |
142 | 142 | |
143 | - if ( $all_the_cool_cats > 1 || is_preview() ) { |
|
143 | + if ($all_the_cool_cats > 1 || is_preview()) { |
|
144 | 144 | // This blog has more than 1 category so twentyfourteen_categorized_blog should return true |
145 | 145 | return true; |
146 | 146 | } else { |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function twentyfourteen_category_transient_flusher() { |
158 | 158 | // Like, beat it. Dig? |
159 | - delete_transient( 'twentyfourteen_category_count' ); |
|
159 | + delete_transient('twentyfourteen_category_count'); |
|
160 | 160 | } |
161 | -add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' ); |
|
162 | -add_action( 'save_post', 'twentyfourteen_category_transient_flusher' ); |
|
161 | +add_action('edit_category', 'twentyfourteen_category_transient_flusher'); |
|
162 | +add_action('save_post', 'twentyfourteen_category_transient_flusher'); |
|
163 | 163 | |
164 | -if ( ! function_exists( 'twentyfourteen_post_thumbnail' ) ) : |
|
164 | +if ( ! function_exists('twentyfourteen_post_thumbnail')) : |
|
165 | 165 | /** |
166 | 166 | * Display an optional post thumbnail. |
167 | 167 | * |
@@ -172,17 +172,17 @@ discard block |
||
172 | 172 | * @since Twenty Fourteen 1.4 Was made 'pluggable', or overridable. |
173 | 173 | */ |
174 | 174 | function twentyfourteen_post_thumbnail() { |
175 | - if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { |
|
175 | + if (post_password_required() || is_attachment() || ! has_post_thumbnail()) { |
|
176 | 176 | return; |
177 | 177 | } |
178 | 178 | |
179 | - if ( is_singular() ) : |
|
179 | + if (is_singular()) : |
|
180 | 180 | ?> |
181 | 181 | |
182 | 182 | <div class="post-thumbnail"> |
183 | 183 | <?php |
184 | - if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) ) { |
|
185 | - the_post_thumbnail( 'twentyfourteen-full-width' ); |
|
184 | + if (( ! is_active_sidebar('sidebar-2') || is_page_template('page-templates/full-width.php'))) { |
|
185 | + the_post_thumbnail('twentyfourteen-full-width'); |
|
186 | 186 | } else { |
187 | 187 | the_post_thumbnail(); |
188 | 188 | } |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | |
194 | 194 | <a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true"> |
195 | 195 | <?php |
196 | - if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) ) { |
|
197 | - the_post_thumbnail( 'twentyfourteen-full-width' ); |
|
196 | + if (( ! is_active_sidebar('sidebar-2') || is_page_template('page-templates/full-width.php'))) { |
|
197 | + the_post_thumbnail('twentyfourteen-full-width'); |
|
198 | 198 | } else { |
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 | ?> |
202 | 202 | </a> |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | endif; |
207 | 207 | |
208 | -if ( ! function_exists( 'twentyfourteen_excerpt_more' ) && ! is_admin() ) : |
|
208 | +if ( ! function_exists('twentyfourteen_excerpt_more') && ! is_admin()) : |
|
209 | 209 | /** |
210 | 210 | * Replaces "[...]" (appended to automatically generated excerpts) with ... |
211 | 211 | * and a Continue reading link. |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @param string $more Default Read More excerpt link. |
216 | 216 | * @return string Filtered Read More excerpt link. |
217 | 217 | */ |
218 | -function twentyfourteen_excerpt_more( $more ) { |
|
219 | - $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>', |
|
220 | - esc_url( get_permalink( get_the_ID() ) ), |
|
218 | +function twentyfourteen_excerpt_more($more) { |
|
219 | + $link = sprintf('<a href="%1$s" class="more-link">%2$s</a>', |
|
220 | + esc_url(get_permalink(get_the_ID())), |
|
221 | 221 | /* translators: %s: Name of current post */ |
222 | - sprintf( __( 'Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) |
|
222 | + sprintf(__('Continue reading %s <span class="meta-nav">→</span>', 'twentyfourteen'), '<span class="screen-reader-text">'.get_the_title(get_the_ID()).'</span>') |
|
223 | 223 | ); |
224 | - return ' … ' . $link; |
|
224 | + return ' … '.$link; |
|
225 | 225 | } |
226 | -add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' ); |
|
226 | +add_filter('excerpt_more', 'twentyfourteen_excerpt_more'); |
|
227 | 227 | endif; |
@@ -125,12 +125,15 @@ discard block |
||
125 | 125 | |
126 | 126 | if ( post_password_required() ) : |
127 | 127 | the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) ); |
128 | - else : |
|
128 | + else { |
|
129 | + : |
|
129 | 130 | $images = array(); |
131 | + } |
|
130 | 132 | |
131 | 133 | $galleries = get_post_galleries( get_the_ID(), false ); |
132 | - if ( isset( $galleries[0]['ids'] ) ) |
|
133 | - $images = explode( ',', $galleries[0]['ids'] ); |
|
134 | + if ( isset( $galleries[0]['ids'] ) ) { |
|
135 | + $images = explode( ',', $galleries[0]['ids'] ); |
|
136 | + } |
|
134 | 137 | |
135 | 138 | if ( ! $images ) : |
136 | 139 | $images = get_posts( array( |
@@ -168,8 +171,10 @@ discard block |
||
168 | 171 | <?php |
169 | 172 | endif; |
170 | 173 | |
171 | - else : |
|
174 | + else { |
|
175 | + : |
|
172 | 176 | the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) ); |
177 | + } |
|
173 | 178 | endif; |
174 | 179 | ?> |
175 | 180 | </div><!-- .entry-content --> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - private $formats = array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery' ); |
|
24 | + private $formats = array('aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Constructor. |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | * @return Twenty_Fourteen_Ephemera_Widget |
32 | 32 | */ |
33 | 33 | public function __construct() { |
34 | - parent::__construct( 'widget_twentyfourteen_ephemera', __( 'Twenty Fourteen Ephemera', 'twentyfourteen' ), array( |
|
34 | + parent::__construct('widget_twentyfourteen_ephemera', __('Twenty Fourteen Ephemera', 'twentyfourteen'), array( |
|
35 | 35 | 'classname' => 'widget_twentyfourteen_ephemera', |
36 | - 'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts.', 'twentyfourteen' ), |
|
36 | + 'description' => __('Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts.', 'twentyfourteen'), |
|
37 | 37 | 'customize_selective_refresh' => true, |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) { |
|
41 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
40 | + if (is_active_widget(false, false, $this->id_base) || is_customize_preview()) { |
|
41 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function enqueue_scripts() { |
51 | 51 | /** This filter is documented in wp-includes/media.php */ |
52 | - $audio_library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ); |
|
52 | + $audio_library = apply_filters('wp_audio_shortcode_library', 'mediaelement'); |
|
53 | 53 | /** This filter is documented in wp-includes/media.php */ |
54 | - $video_library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' ); |
|
55 | - if ( in_array( 'mediaelement', array( $video_library, $audio_library ), true ) ) { |
|
56 | - wp_enqueue_style( 'wp-mediaelement' ); |
|
57 | - wp_enqueue_script( 'wp-mediaelement' ); |
|
54 | + $video_library = apply_filters('wp_video_shortcode_library', 'mediaelement'); |
|
55 | + if (in_array('mediaelement', array($video_library, $audio_library), true)) { |
|
56 | + wp_enqueue_style('wp-mediaelement'); |
|
57 | + wp_enqueue_script('wp-mediaelement'); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -67,73 +67,73 @@ discard block |
||
67 | 67 | * @param array $args An array of standard parameters for widgets in this theme. |
68 | 68 | * @param array $instance An array of settings for this widget instance. |
69 | 69 | */ |
70 | - public function widget( $args, $instance ) { |
|
71 | - $format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside'; |
|
70 | + public function widget($args, $instance) { |
|
71 | + $format = isset($instance['format']) && in_array($instance['format'], $this->formats) ? $instance['format'] : 'aside'; |
|
72 | 72 | |
73 | - switch ( $format ) { |
|
73 | + switch ($format) { |
|
74 | 74 | case 'image': |
75 | - $format_string = __( 'Images', 'twentyfourteen' ); |
|
76 | - $format_string_more = __( 'More images', 'twentyfourteen' ); |
|
75 | + $format_string = __('Images', 'twentyfourteen'); |
|
76 | + $format_string_more = __('More images', 'twentyfourteen'); |
|
77 | 77 | break; |
78 | 78 | case 'video': |
79 | - $format_string = __( 'Videos', 'twentyfourteen' ); |
|
80 | - $format_string_more = __( 'More videos', 'twentyfourteen' ); |
|
79 | + $format_string = __('Videos', 'twentyfourteen'); |
|
80 | + $format_string_more = __('More videos', 'twentyfourteen'); |
|
81 | 81 | break; |
82 | 82 | case 'audio': |
83 | - $format_string = __( 'Audio', 'twentyfourteen' ); |
|
84 | - $format_string_more = __( 'More audio', 'twentyfourteen' ); |
|
83 | + $format_string = __('Audio', 'twentyfourteen'); |
|
84 | + $format_string_more = __('More audio', 'twentyfourteen'); |
|
85 | 85 | break; |
86 | 86 | case 'quote': |
87 | - $format_string = __( 'Quotes', 'twentyfourteen' ); |
|
88 | - $format_string_more = __( 'More quotes', 'twentyfourteen' ); |
|
87 | + $format_string = __('Quotes', 'twentyfourteen'); |
|
88 | + $format_string_more = __('More quotes', 'twentyfourteen'); |
|
89 | 89 | break; |
90 | 90 | case 'link': |
91 | - $format_string = __( 'Links', 'twentyfourteen' ); |
|
92 | - $format_string_more = __( 'More links', 'twentyfourteen' ); |
|
91 | + $format_string = __('Links', 'twentyfourteen'); |
|
92 | + $format_string_more = __('More links', 'twentyfourteen'); |
|
93 | 93 | break; |
94 | 94 | case 'gallery': |
95 | - $format_string = __( 'Galleries', 'twentyfourteen' ); |
|
96 | - $format_string_more = __( 'More galleries', 'twentyfourteen' ); |
|
95 | + $format_string = __('Galleries', 'twentyfourteen'); |
|
96 | + $format_string_more = __('More galleries', 'twentyfourteen'); |
|
97 | 97 | break; |
98 | 98 | case 'aside': |
99 | 99 | default: |
100 | - $format_string = __( 'Asides', 'twentyfourteen' ); |
|
101 | - $format_string_more = __( 'More asides', 'twentyfourteen' ); |
|
100 | + $format_string = __('Asides', 'twentyfourteen'); |
|
101 | + $format_string_more = __('More asides', 'twentyfourteen'); |
|
102 | 102 | break; |
103 | 103 | } |
104 | 104 | |
105 | - $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] ); |
|
106 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? $format_string : $instance['title'], $instance, $this->id_base ); |
|
105 | + $number = empty($instance['number']) ? 2 : absint($instance['number']); |
|
106 | + $title = apply_filters('widget_title', empty($instance['title']) ? $format_string : $instance['title'], $instance, $this->id_base); |
|
107 | 107 | |
108 | - $ephemera = new WP_Query( array( |
|
108 | + $ephemera = new WP_Query(array( |
|
109 | 109 | 'order' => 'DESC', |
110 | 110 | 'posts_per_page' => $number, |
111 | 111 | 'no_found_rows' => true, |
112 | 112 | 'post_status' => 'publish', |
113 | - 'post__not_in' => get_option( 'sticky_posts' ), |
|
113 | + 'post__not_in' => get_option('sticky_posts'), |
|
114 | 114 | 'tax_query' => array( |
115 | 115 | array( |
116 | 116 | 'taxonomy' => 'post_format', |
117 | - 'terms' => array( "post-format-$format" ), |
|
117 | + 'terms' => array("post-format-$format"), |
|
118 | 118 | 'field' => 'slug', |
119 | 119 | 'operator' => 'IN', |
120 | 120 | ), |
121 | 121 | ), |
122 | - ) ); |
|
122 | + )); |
|
123 | 123 | |
124 | - if ( $ephemera->have_posts() ) : |
|
124 | + if ($ephemera->have_posts()) : |
|
125 | 125 | $tmp_content_width = $GLOBALS['content_width']; |
126 | 126 | $GLOBALS['content_width'] = 306; |
127 | 127 | |
128 | 128 | echo $args['before_widget']; |
129 | 129 | ?> |
130 | - <h1 class="widget-title <?php echo esc_attr( $format ); ?>"> |
|
131 | - <a class="entry-format" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php echo esc_html( $title ); ?></a> |
|
130 | + <h1 class="widget-title <?php echo esc_attr($format); ?>"> |
|
131 | + <a class="entry-format" href="<?php echo esc_url(get_post_format_link($format)); ?>"><?php echo esc_html($title); ?></a> |
|
132 | 132 | </h1> |
133 | 133 | <ol> |
134 | 134 | |
135 | 135 | <?php |
136 | - while ( $ephemera->have_posts() ) : |
|
136 | + while ($ephemera->have_posts()) : |
|
137 | 137 | $ephemera->the_post(); |
138 | 138 | $tmp_more = $GLOBALS['more']; |
139 | 139 | $GLOBALS['more'] = 0; |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | <article <?php post_class(); ?>> |
143 | 143 | <div class="entry-content"> |
144 | 144 | <?php |
145 | - if ( has_post_format( 'gallery' ) ) : |
|
145 | + if (has_post_format('gallery')) : |
|
146 | 146 | |
147 | - if ( post_password_required() ) : |
|
148 | - the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) ); |
|
147 | + if (post_password_required()) : |
|
148 | + the_content(__('Continue reading <span class="meta-nav">→</span>', 'twentyfourteen')); |
|
149 | 149 | else : |
150 | 150 | $images = array(); |
151 | 151 | |
152 | - $galleries = get_post_galleries( get_the_ID(), false ); |
|
153 | - if ( isset( $galleries[0]['ids'] ) ) |
|
154 | - $images = explode( ',', $galleries[0]['ids'] ); |
|
152 | + $galleries = get_post_galleries(get_the_ID(), false); |
|
153 | + if (isset($galleries[0]['ids'])) |
|
154 | + $images = explode(',', $galleries[0]['ids']); |
|
155 | 155 | |
156 | - if ( ! $images ) : |
|
157 | - $images = get_posts( array( |
|
156 | + if ( ! $images) : |
|
157 | + $images = get_posts(array( |
|
158 | 158 | 'fields' => 'ids', |
159 | 159 | 'numberposts' => -1, |
160 | 160 | 'order' => 'ASC', |
@@ -162,27 +162,27 @@ discard block |
||
162 | 162 | 'post_mime_type' => 'image', |
163 | 163 | 'post_parent' => get_the_ID(), |
164 | 164 | 'post_type' => 'attachment', |
165 | - ) ); |
|
165 | + )); |
|
166 | 166 | endif; |
167 | 167 | |
168 | - $total_images = count( $images ); |
|
168 | + $total_images = count($images); |
|
169 | 169 | |
170 | - if ( has_post_thumbnail() ) : |
|
170 | + if (has_post_thumbnail()) : |
|
171 | 171 | $post_thumbnail = get_the_post_thumbnail(); |
172 | - elseif ( $total_images > 0 ) : |
|
173 | - $image = reset( $images ); |
|
174 | - $post_thumbnail = wp_get_attachment_image( $image, 'post-thumbnail' ); |
|
172 | + elseif ($total_images > 0) : |
|
173 | + $image = reset($images); |
|
174 | + $post_thumbnail = wp_get_attachment_image($image, 'post-thumbnail'); |
|
175 | 175 | endif; |
176 | 176 | |
177 | - if ( ! empty ( $post_thumbnail ) ) : |
|
177 | + if ( ! empty ($post_thumbnail)) : |
|
178 | 178 | ?> |
179 | 179 | <a href="<?php the_permalink(); ?>"><?php echo $post_thumbnail; ?></a> |
180 | 180 | <?php endif; ?> |
181 | 181 | <p class="wp-caption-text"> |
182 | 182 | <?php |
183 | - printf( _n( 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photo</a>.', 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photos</a>.', $total_images, 'twentyfourteen' ), |
|
184 | - esc_url( get_permalink() ), |
|
185 | - number_format_i18n( $total_images ) |
|
183 | + printf(_n('This gallery contains <a href="%1$s" rel="bookmark">%2$s photo</a>.', 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photos</a>.', $total_images, 'twentyfourteen'), |
|
184 | + esc_url(get_permalink()), |
|
185 | + number_format_i18n($total_images) |
|
186 | 186 | ); |
187 | 187 | ?> |
188 | 188 | </p> |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | endif; |
191 | 191 | |
192 | 192 | else : |
193 | - the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) ); |
|
193 | + the_content(__('Continue reading <span class="meta-nav">→</span>', 'twentyfourteen')); |
|
194 | 194 | endif; |
195 | 195 | ?> |
196 | 196 | </div><!-- .entry-content --> |
@@ -198,21 +198,21 @@ discard block |
||
198 | 198 | <header class="entry-header"> |
199 | 199 | <div class="entry-meta"> |
200 | 200 | <?php |
201 | - if ( ! has_post_format( 'link' ) ) : |
|
202 | - the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); |
|
201 | + if ( ! has_post_format('link')) : |
|
202 | + the_title('<h1 class="entry-title"><a href="'.esc_url(get_permalink()).'" rel="bookmark">', '</a></h1>'); |
|
203 | 203 | endif; |
204 | 204 | |
205 | - printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', |
|
206 | - esc_url( get_permalink() ), |
|
207 | - esc_attr( get_the_date( 'c' ) ), |
|
208 | - esc_html( get_the_date() ), |
|
209 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
205 | + printf('<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', |
|
206 | + esc_url(get_permalink()), |
|
207 | + esc_attr(get_the_date('c')), |
|
208 | + esc_html(get_the_date()), |
|
209 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
210 | 210 | get_the_author() |
211 | 211 | ); |
212 | 212 | |
213 | - if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : |
|
213 | + if ( ! post_password_required() && (comments_open() || get_comments_number())) : |
|
214 | 214 | ?> |
215 | - <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span> |
|
215 | + <span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'twentyfourteen'), __('1 Comment', 'twentyfourteen'), __('% Comments', 'twentyfourteen')); ?></span> |
|
216 | 216 | <?php endif; ?> |
217 | 217 | </div><!-- .entry-meta --> |
218 | 218 | </header><!-- .entry-header --> |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | <?php endwhile; ?> |
222 | 222 | |
223 | 223 | </ol> |
224 | - <a class="post-format-archive-link" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"> |
|
224 | + <a class="post-format-archive-link" href="<?php echo esc_url(get_post_format_link($format)); ?>"> |
|
225 | 225 | <?php |
226 | 226 | /* translators: used with More archives link */ |
227 | - printf( __( '%s <span class="meta-nav">→</span>', 'twentyfourteen' ), $format_string_more ); |
|
227 | + printf(__('%s <span class="meta-nav">→</span>', 'twentyfourteen'), $format_string_more); |
|
228 | 228 | ?> |
229 | 229 | </a> |
230 | 230 | <?php |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | * @param array $instance Original widget instance. |
252 | 252 | * @return array Updated widget instance. |
253 | 253 | */ |
254 | - function update( $new_instance, $instance ) { |
|
255 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
256 | - $instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] ); |
|
257 | - if ( in_array( $new_instance['format'], $this->formats ) ) { |
|
254 | + function update($new_instance, $instance) { |
|
255 | + $instance['title'] = strip_tags($new_instance['title']); |
|
256 | + $instance['number'] = empty($new_instance['number']) ? 2 : absint($new_instance['number']); |
|
257 | + if (in_array($new_instance['format'], $this->formats)) { |
|
258 | 258 | $instance['format'] = $new_instance['format']; |
259 | 259 | } |
260 | 260 | |
@@ -268,21 +268,21 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @param array $instance |
270 | 270 | */ |
271 | - function form( $instance ) { |
|
272 | - $title = empty( $instance['title'] ) ? '' : esc_attr( $instance['title'] ); |
|
273 | - $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] ); |
|
274 | - $format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside'; |
|
271 | + function form($instance) { |
|
272 | + $title = empty($instance['title']) ? '' : esc_attr($instance['title']); |
|
273 | + $number = empty($instance['number']) ? 2 : absint($instance['number']); |
|
274 | + $format = isset($instance['format']) && in_array($instance['format'], $this->formats) ? $instance['format'] : 'aside'; |
|
275 | 275 | ?> |
276 | - <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyfourteen' ); ?></label> |
|
277 | - <input id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"></p> |
|
276 | + <p><label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'twentyfourteen'); ?></label> |
|
277 | + <input id="<?php echo esc_attr($this->get_field_id('title')); ?>" class="widefat" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>"></p> |
|
278 | 278 | |
279 | - <p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:', 'twentyfourteen' ); ?></label> |
|
280 | - <input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3"></p> |
|
279 | + <p><label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php _e('Number of posts to show:', 'twentyfourteen'); ?></label> |
|
280 | + <input id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" size="3"></p> |
|
281 | 281 | |
282 | - <p><label for="<?php echo esc_attr( $this->get_field_id( 'format' ) ); ?>"><?php _e( 'Post format to show:', 'twentyfourteen' ); ?></label> |
|
283 | - <select id="<?php echo esc_attr( $this->get_field_id( 'format' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'format' ) ); ?>"> |
|
284 | - <?php foreach ( $this->formats as $slug ) : ?> |
|
285 | - <option value="<?php echo esc_attr( $slug ); ?>"<?php selected( $format, $slug ); ?>><?php echo esc_html( get_post_format_string( $slug ) ); ?></option> |
|
282 | + <p><label for="<?php echo esc_attr($this->get_field_id('format')); ?>"><?php _e('Post format to show:', 'twentyfourteen'); ?></label> |
|
283 | + <select id="<?php echo esc_attr($this->get_field_id('format')); ?>" class="widefat" name="<?php echo esc_attr($this->get_field_name('format')); ?>"> |
|
284 | + <?php foreach ($this->formats as $slug) : ?> |
|
285 | + <option value="<?php echo esc_attr($slug); ?>"<?php selected($format, $slug); ?>><?php echo esc_html(get_post_format_string($slug)); ?></option> |
|
286 | 286 | <?php endforeach; ?> |
287 | 287 | </select> |
288 | 288 | <?php |