@@ -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(); |
@@ -58,9 +58,11 @@ |
||
| 58 | 58 | // Previous/next page navigation. |
| 59 | 59 | twentyfourteen_paging_nav(); |
| 60 | 60 | |
| 61 | - else : |
|
| 61 | + else { |
|
| 62 | + : |
|
| 62 | 63 | // If no content, include the "No posts found" template. |
| 63 | 64 | get_template_part( 'content', 'none' ); |
| 65 | + } |
|
| 64 | 66 | |
| 65 | 67 | endif; |
| 66 | 68 | ?> |
@@ -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(); |
@@ -36,8 +36,10 @@ discard block |
||
| 36 | 36 | elseif ( is_year() ) : |
| 37 | 37 | printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfourteen' ) ) ); |
| 38 | 38 | |
| 39 | - else : |
|
| 39 | + else { |
|
| 40 | + : |
|
| 40 | 41 | _e( 'Archives', 'twentyfourteen' ); |
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | endif; |
| 43 | 45 | ?> |
@@ -59,9 +61,11 @@ discard block |
||
| 59 | 61 | // Previous/next page navigation. |
| 60 | 62 | twentyfourteen_paging_nav(); |
| 61 | 63 | |
| 62 | - else : |
|
| 64 | + else { |
|
| 65 | + : |
|
| 63 | 66 | // If no content, include the "No posts found" template. |
| 64 | 67 | get_template_part( 'content', 'none' ); |
| 68 | + } |
|
| 65 | 69 | |
| 66 | 70 | endif; |
| 67 | 71 | ?> |
@@ -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(); |
@@ -58,9 +58,11 @@ |
||
| 58 | 58 | // Previous/next page navigation. |
| 59 | 59 | twentyfourteen_paging_nav(); |
| 60 | 60 | |
| 61 | - else : |
|
| 61 | + else { |
|
| 62 | + : |
|
| 62 | 63 | // If no content, include the "No posts found" template. |
| 63 | 64 | get_template_part( 'content', 'none' ); |
| 65 | + } |
|
| 64 | 66 | |
| 65 | 67 | endif; |
| 66 | 68 | ?> |
@@ -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 | ?> |
@@ -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 ( 1 !== (int) $all_the_cool_cats ) { |
|
| 143 | + if (1 !== (int) $all_the_cool_cats) { |
|
| 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; |
@@ -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' ); |
@@ -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 |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @since Twenty Fourteen 1.0 |
| 40 | 40 | */ |
| 41 | 41 | public static function setup() { |
| 42 | - add_action( 'init', array( __CLASS__, 'init' ), 30 ); |
|
| 42 | + add_action('init', array(__CLASS__, 'init'), 30); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | * @since Twenty Fourteen 1.0 |
| 57 | 57 | */ |
| 58 | 58 | public static function init() { |
| 59 | - $theme_support = get_theme_support( 'featured-content' ); |
|
| 59 | + $theme_support = get_theme_support('featured-content'); |
|
| 60 | 60 | |
| 61 | 61 | // Return early if theme does not support Featured Content. |
| 62 | - if ( ! $theme_support ) { |
|
| 62 | + if ( ! $theme_support) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -67,31 +67,31 @@ discard block |
||
| 67 | 67 | * An array of named arguments must be passed as the second parameter |
| 68 | 68 | * of add_theme_support(). |
| 69 | 69 | */ |
| 70 | - if ( ! isset( $theme_support[0] ) ) { |
|
| 70 | + if ( ! isset($theme_support[0])) { |
|
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Return early if "featured_content_filter" has not been defined. |
| 75 | - if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) { |
|
| 75 | + if ( ! isset($theme_support[0]['featured_content_filter'])) { |
|
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $filter = $theme_support[0]['featured_content_filter']; |
| 80 | 80 | |
| 81 | 81 | // Theme can override the number of max posts. |
| 82 | - if ( isset( $theme_support[0]['max_posts'] ) ) { |
|
| 83 | - self::$max_posts = absint( $theme_support[0]['max_posts'] ); |
|
| 82 | + if (isset($theme_support[0]['max_posts'])) { |
|
| 83 | + self::$max_posts = absint($theme_support[0]['max_posts']); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) ); |
|
| 87 | - add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 ); |
|
| 88 | - add_action( 'admin_init', array( __CLASS__, 'register_setting' ) ); |
|
| 89 | - add_action( 'switch_theme', array( __CLASS__, 'delete_transient' ) ); |
|
| 90 | - add_action( 'save_post', array( __CLASS__, 'delete_transient' ) ); |
|
| 91 | - add_action( 'delete_post_tag', array( __CLASS__, 'delete_post_tag' ) ); |
|
| 92 | - add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) ); |
|
| 93 | - add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) ); |
|
| 94 | - add_action( 'wp_loaded', array( __CLASS__, 'wp_loaded' ) ); |
|
| 86 | + add_filter($filter, array(__CLASS__, 'get_featured_posts')); |
|
| 87 | + add_action('customize_register', array(__CLASS__, 'customize_register'), 9); |
|
| 88 | + add_action('admin_init', array(__CLASS__, 'register_setting')); |
|
| 89 | + add_action('switch_theme', array(__CLASS__, 'delete_transient')); |
|
| 90 | + add_action('save_post', array(__CLASS__, 'delete_transient')); |
|
| 91 | + add_action('delete_post_tag', array(__CLASS__, 'delete_post_tag')); |
|
| 92 | + add_action('customize_controls_enqueue_scripts', array(__CLASS__, 'enqueue_scripts')); |
|
| 93 | + add_action('pre_get_posts', array(__CLASS__, 'pre_get_posts')); |
|
| 94 | + add_action('wp_loaded', array(__CLASS__, 'wp_loaded')); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | * @since Twenty Fourteen 1.0 |
| 106 | 106 | */ |
| 107 | 107 | public static function wp_loaded() { |
| 108 | - if ( self::get_setting( 'hide-tag' ) ) { |
|
| 109 | - add_filter( 'get_terms', array( __CLASS__, 'hide_featured_term' ), 10, 3 ); |
|
| 110 | - add_filter( 'get_the_terms', array( __CLASS__, 'hide_the_featured_term' ), 10, 3 ); |
|
| 108 | + if (self::get_setting('hide-tag')) { |
|
| 109 | + add_filter('get_terms', array(__CLASS__, 'hide_featured_term'), 10, 3); |
|
| 110 | + add_filter('get_the_terms', array(__CLASS__, 'hide_the_featured_term'), 10, 3); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | $post_ids = self::get_featured_post_ids(); |
| 125 | 125 | |
| 126 | 126 | // No need to query if there is are no featured posts. |
| 127 | - if ( empty( $post_ids ) ) { |
|
| 127 | + if (empty($post_ids)) { |
|
| 128 | 128 | return array(); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $featured_posts = get_posts( array( |
|
| 131 | + $featured_posts = get_posts(array( |
|
| 132 | 132 | 'include' => $post_ids, |
| 133 | - 'posts_per_page' => count( $post_ids ), |
|
| 134 | - ) ); |
|
| 133 | + 'posts_per_page' => count($post_ids), |
|
| 134 | + )); |
|
| 135 | 135 | |
| 136 | 136 | return $featured_posts; |
| 137 | 137 | } |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public static function get_featured_post_ids() { |
| 154 | 154 | // Get array of cached results if they exist. |
| 155 | - $featured_ids = get_transient( 'featured_content_ids' ); |
|
| 155 | + $featured_ids = get_transient('featured_content_ids'); |
|
| 156 | 156 | |
| 157 | - if ( false === $featured_ids ) { |
|
| 157 | + if (false === $featured_ids) { |
|
| 158 | 158 | $settings = self::get_setting(); |
| 159 | - $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' ); |
|
| 159 | + $term = get_term_by('name', $settings['tag-name'], 'post_tag'); |
|
| 160 | 160 | |
| 161 | - if ( $term ) { |
|
| 161 | + if ($term) { |
|
| 162 | 162 | // Query for featured posts. |
| 163 | - $featured_ids = get_posts( array( |
|
| 163 | + $featured_ids = get_posts(array( |
|
| 164 | 164 | 'fields' => 'ids', |
| 165 | 165 | 'numberposts' => self::$max_posts, |
| 166 | 166 | 'suppress_filters' => false, |
@@ -171,19 +171,19 @@ discard block |
||
| 171 | 171 | 'terms' => $term->term_id, |
| 172 | 172 | ), |
| 173 | 173 | ), |
| 174 | - ) ); |
|
| 174 | + )); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // Get sticky posts if no Featured Content exists. |
| 178 | - if ( ! $featured_ids ) { |
|
| 178 | + if ( ! $featured_ids) { |
|
| 179 | 179 | $featured_ids = self::get_sticky_posts(); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - set_transient( 'featured_content_ids', $featured_ids ); |
|
| 182 | + set_transient('featured_content_ids', $featured_ids); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // Ensure correct format before return. |
| 186 | - return array_map( 'absint', $featured_ids ); |
|
| 186 | + return array_map('absint', $featured_ids); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @return array Array of sticky posts. |
| 197 | 197 | */ |
| 198 | 198 | public static function get_sticky_posts() { |
| 199 | - return array_slice( get_option( 'sticky_posts', array() ), 0, self::$max_posts ); |
|
| 199 | + return array_slice(get_option('sticky_posts', array()), 0, self::$max_posts); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @since Twenty Fourteen 1.0 |
| 212 | 212 | */ |
| 213 | 213 | public static function delete_transient() { |
| 214 | - delete_transient( 'featured_content_ids' ); |
|
| 214 | + delete_transient('featured_content_ids'); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -228,34 +228,34 @@ discard block |
||
| 228 | 228 | * @param WP_Query $query WP_Query object. |
| 229 | 229 | * @return WP_Query Possibly-modified WP_Query. |
| 230 | 230 | */ |
| 231 | - public static function pre_get_posts( $query ) { |
|
| 231 | + public static function pre_get_posts($query) { |
|
| 232 | 232 | |
| 233 | 233 | // Bail if not home or not main query. |
| 234 | - if ( ! $query->is_home() || ! $query->is_main_query() ) { |
|
| 234 | + if ( ! $query->is_home() || ! $query->is_main_query()) { |
|
| 235 | 235 | return; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Bail if the blog page is not the front page. |
| 239 | - if ( 'posts' !== get_option( 'show_on_front' ) ) { |
|
| 239 | + if ('posts' !== get_option('show_on_front')) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $featured = self::get_featured_post_ids(); |
| 244 | 244 | |
| 245 | 245 | // Bail if no featured posts. |
| 246 | - if ( ! $featured ) { |
|
| 246 | + if ( ! $featured) { |
|
| 247 | 247 | return; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // We need to respect post ids already in the blacklist. |
| 251 | - $post__not_in = $query->get( 'post__not_in' ); |
|
| 251 | + $post__not_in = $query->get('post__not_in'); |
|
| 252 | 252 | |
| 253 | - if ( ! empty( $post__not_in ) ) { |
|
| 254 | - $featured = array_merge( (array) $post__not_in, $featured ); |
|
| 255 | - $featured = array_unique( $featured ); |
|
| 253 | + if ( ! empty($post__not_in)) { |
|
| 254 | + $featured = array_merge((array) $post__not_in, $featured); |
|
| 255 | + $featured = array_unique($featured); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $query->set( 'post__not_in', $featured ); |
|
| 258 | + $query->set('post__not_in', $featured); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -275,16 +275,16 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @param int $tag_id The term_id of the tag that has been deleted. |
| 277 | 277 | */ |
| 278 | - public static function delete_post_tag( $tag_id ) { |
|
| 278 | + public static function delete_post_tag($tag_id) { |
|
| 279 | 279 | $settings = self::get_setting(); |
| 280 | 280 | |
| 281 | - if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) { |
|
| 281 | + if (empty($settings['tag-id']) || $tag_id != $settings['tag-id']) { |
|
| 282 | 282 | return; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $settings['tag-id'] = 0; |
| 286 | - $settings = self::validate_settings( $settings ); |
|
| 287 | - update_option( 'featured-content', $settings ); |
|
| 286 | + $settings = self::validate_settings($settings); |
|
| 287 | + update_option('featured-content', $settings); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -302,32 +302,32 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @uses Featured_Content::get_setting() |
| 304 | 304 | */ |
| 305 | - public static function hide_featured_term( $terms, $taxonomies, $args ) { |
|
| 305 | + public static function hide_featured_term($terms, $taxonomies, $args) { |
|
| 306 | 306 | |
| 307 | 307 | // This filter is only appropriate on the front-end. |
| 308 | - if ( is_admin() ) { |
|
| 308 | + if (is_admin()) { |
|
| 309 | 309 | return $terms; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // We only want to hide the featured tag. |
| 313 | - if ( ! in_array( 'post_tag', $taxonomies ) ) { |
|
| 313 | + if ( ! in_array('post_tag', $taxonomies)) { |
|
| 314 | 314 | return $terms; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | // Bail if no terms were returned. |
| 318 | - if ( empty( $terms ) ) { |
|
| 318 | + if (empty($terms)) { |
|
| 319 | 319 | return $terms; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | // Bail if term objects are unavailable. |
| 323 | - if ( 'all' != $args['fields'] ) { |
|
| 323 | + if ('all' != $args['fields']) { |
|
| 324 | 324 | return $terms; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $settings = self::get_setting(); |
| 328 | - foreach ( $terms as $order => $term ) { |
|
| 329 | - if ( ( $settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name ) && 'post_tag' === $term->taxonomy ) { |
|
| 330 | - unset( $terms[ $order ] ); |
|
| 328 | + foreach ($terms as $order => $term) { |
|
| 329 | + if (($settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name) && 'post_tag' === $term->taxonomy) { |
|
| 330 | + unset($terms[$order]); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
@@ -351,27 +351,27 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @uses Featured_Content::get_setting() |
| 353 | 353 | */ |
| 354 | - public static function hide_the_featured_term( $terms, $id, $taxonomy ) { |
|
| 354 | + public static function hide_the_featured_term($terms, $id, $taxonomy) { |
|
| 355 | 355 | |
| 356 | 356 | // This filter is only appropriate on the front-end. |
| 357 | - if ( is_admin() ) { |
|
| 357 | + if (is_admin()) { |
|
| 358 | 358 | return $terms; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | // Make sure we are in the correct taxonomy. |
| 362 | - if ( 'post_tag' != $taxonomy ) { |
|
| 362 | + if ('post_tag' != $taxonomy) { |
|
| 363 | 363 | return $terms; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // No terms? Return early! |
| 367 | - if ( empty( $terms ) ) { |
|
| 367 | + if (empty($terms)) { |
|
| 368 | 368 | return $terms; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $settings = self::get_setting(); |
| 372 | - foreach ( $terms as $order => $term ) { |
|
| 373 | - if ( ( $settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name ) && 'post_tag' === $term->taxonomy ) { |
|
| 374 | - unset( $terms[ $term->term_id ] ); |
|
| 372 | + foreach ($terms as $order => $term) { |
|
| 373 | + if (($settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name) && 'post_tag' === $term->taxonomy) { |
|
| 374 | + unset($terms[$term->term_id]); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | * @since Twenty Fourteen 1.0 |
| 387 | 387 | */ |
| 388 | 388 | public static function register_setting() { |
| 389 | - register_setting( 'featured-content', 'featured-content', array( __CLASS__, 'validate_settings' ) ); |
|
| 389 | + register_setting('featured-content', 'featured-content', array(__CLASS__, 'validate_settings')); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -398,41 +398,41 @@ discard block |
||
| 398 | 398 | * |
| 399 | 399 | * @param WP_Customize_Manager $wp_customize Customizer object. |
| 400 | 400 | */ |
| 401 | - public static function customize_register( $wp_customize ) { |
|
| 402 | - $wp_customize->add_section( 'featured_content', array( |
|
| 403 | - 'title' => __( 'Featured Content', 'twentyfourteen' ), |
|
| 404 | - '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' ), |
|
| 405 | - esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), |
|
| 406 | - admin_url( 'edit.php?show_sticky=1' ) |
|
| 401 | + public static function customize_register($wp_customize) { |
|
| 402 | + $wp_customize->add_section('featured_content', array( |
|
| 403 | + 'title' => __('Featured Content', 'twentyfourteen'), |
|
| 404 | + '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'), |
|
| 405 | + esc_url(add_query_arg('tag', _x('featured', 'featured content default tag slug', 'twentyfourteen'), admin_url('edit.php'))), |
|
| 406 | + admin_url('edit.php?show_sticky=1') |
|
| 407 | 407 | ), |
| 408 | 408 | 'priority' => 130, |
| 409 | 409 | 'theme_supports' => 'featured-content', |
| 410 | - ) ); |
|
| 410 | + )); |
|
| 411 | 411 | |
| 412 | 412 | // Add Featured Content settings. |
| 413 | - $wp_customize->add_setting( 'featured-content[tag-name]', array( |
|
| 414 | - 'default' => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), |
|
| 413 | + $wp_customize->add_setting('featured-content[tag-name]', array( |
|
| 414 | + 'default' => _x('featured', 'featured content default tag slug', 'twentyfourteen'), |
|
| 415 | 415 | 'type' => 'option', |
| 416 | - 'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ), |
|
| 417 | - ) ); |
|
| 418 | - $wp_customize->add_setting( 'featured-content[hide-tag]', array( |
|
| 416 | + 'sanitize_js_callback' => array(__CLASS__, 'delete_transient'), |
|
| 417 | + )); |
|
| 418 | + $wp_customize->add_setting('featured-content[hide-tag]', array( |
|
| 419 | 419 | 'default' => true, |
| 420 | 420 | 'type' => 'option', |
| 421 | - 'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ), |
|
| 422 | - ) ); |
|
| 421 | + 'sanitize_js_callback' => array(__CLASS__, 'delete_transient'), |
|
| 422 | + )); |
|
| 423 | 423 | |
| 424 | 424 | // Add Featured Content controls. |
| 425 | - $wp_customize->add_control( 'featured-content[tag-name]', array( |
|
| 426 | - 'label' => __( 'Tag Name', 'twentyfourteen' ), |
|
| 425 | + $wp_customize->add_control('featured-content[tag-name]', array( |
|
| 426 | + 'label' => __('Tag Name', 'twentyfourteen'), |
|
| 427 | 427 | 'section' => 'featured_content', |
| 428 | 428 | 'priority' => 20, |
| 429 | - ) ); |
|
| 430 | - $wp_customize->add_control( 'featured-content[hide-tag]', array( |
|
| 431 | - 'label' => __( 'Don’t display tag on front end.', 'twentyfourteen' ), |
|
| 429 | + )); |
|
| 430 | + $wp_customize->add_control('featured-content[hide-tag]', array( |
|
| 431 | + 'label' => __('Don’t display tag on front end.', 'twentyfourteen'), |
|
| 432 | 432 | 'section' => 'featured_content', |
| 433 | 433 | 'type' => 'checkbox', |
| 434 | 434 | 'priority' => 30, |
| 435 | - ) ); |
|
| 435 | + )); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | * @since Twenty Fourteen 1.0 |
| 444 | 444 | */ |
| 445 | 445 | public static function enqueue_scripts() { |
| 446 | - wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20131022', true ); |
|
| 446 | + wp_enqueue_script('featured-content-suggest', get_template_directory_uri().'/js/featured-content-admin.js', array('jquery', 'suggest'), '20131022', true); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -465,20 +465,20 @@ discard block |
||
| 465 | 465 | * @param string $key The key of a recognized setting. |
| 466 | 466 | * @return mixed Array of all settings by default. A single value if passed as first parameter. |
| 467 | 467 | */ |
| 468 | - public static function get_setting( $key = 'all' ) { |
|
| 469 | - $saved = (array) get_option( 'featured-content' ); |
|
| 468 | + public static function get_setting($key = 'all') { |
|
| 469 | + $saved = (array) get_option('featured-content'); |
|
| 470 | 470 | |
| 471 | 471 | $defaults = array( |
| 472 | 472 | 'hide-tag' => 1, |
| 473 | 473 | 'tag-id' => 0, |
| 474 | - 'tag-name' => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), |
|
| 474 | + 'tag-name' => _x('featured', 'featured content default tag slug', 'twentyfourteen'), |
|
| 475 | 475 | ); |
| 476 | 476 | |
| 477 | - $options = wp_parse_args( $saved, $defaults ); |
|
| 478 | - $options = array_intersect_key( $options, $defaults ); |
|
| 477 | + $options = wp_parse_args($saved, $defaults); |
|
| 478 | + $options = array_intersect_key($options, $defaults); |
|
| 479 | 479 | |
| 480 | - if ( 'all' != $key ) { |
|
| 481 | - return isset( $options[ $key ] ) ? $options[ $key ] : false; |
|
| 480 | + if ('all' != $key) { |
|
| 481 | + return isset($options[$key]) ? $options[$key] : false; |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | return $options; |
@@ -498,20 +498,20 @@ discard block |
||
| 498 | 498 | * @param array $input Array of settings input. |
| 499 | 499 | * @return array Validated settings output. |
| 500 | 500 | */ |
| 501 | - public static function validate_settings( $input ) { |
|
| 501 | + public static function validate_settings($input) { |
|
| 502 | 502 | $output = array(); |
| 503 | 503 | |
| 504 | - if ( empty( $input['tag-name'] ) ) { |
|
| 504 | + if (empty($input['tag-name'])) { |
|
| 505 | 505 | $output['tag-id'] = 0; |
| 506 | 506 | } else { |
| 507 | - $term = get_term_by( 'name', $input['tag-name'], 'post_tag' ); |
|
| 507 | + $term = get_term_by('name', $input['tag-name'], 'post_tag'); |
|
| 508 | 508 | |
| 509 | - if ( $term ) { |
|
| 509 | + if ($term) { |
|
| 510 | 510 | $output['tag-id'] = $term->term_id; |
| 511 | 511 | } else { |
| 512 | - $new_tag = wp_create_tag( $input['tag-name'] ); |
|
| 512 | + $new_tag = wp_create_tag($input['tag-name']); |
|
| 513 | 513 | |
| 514 | - if ( ! is_wp_error( $new_tag ) && isset( $new_tag['term_id'] ) ) { |
|
| 514 | + if ( ! is_wp_error($new_tag) && isset($new_tag['term_id'])) { |
|
| 515 | 515 | $output['tag-id'] = $new_tag['term_id']; |
| 516 | 516 | } |
| 517 | 517 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | $output['tag-name'] = $input['tag-name']; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - $output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0; |
|
| 522 | + $output['hide-tag'] = isset($input['hide-tag']) && $input['hide-tag'] ? 1 : 0; |
|
| 523 | 523 | |
| 524 | 524 | // Delete the featured post ids transient. |
| 525 | 525 | self::delete_transient(); |