Twenty Fourteen: updates all PHP files to meet new brace style in WP coding standards. Props rickalee for initial patch, fixes #26093.

git-svn-id: https://develop.svn.wordpress.org/trunk@26260 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2013-11-18 23:11:01 +00:00
parent b01698ee01
commit 7a9d3855d4
14 changed files with 142 additions and 75 deletions

View File

@ -13,8 +13,9 @@
* If the current post is protected by a password and the visitor has not yet * If the current post is protected by a password and the visitor has not yet
* entered the password we will return early without loading the comments. * entered the password we will return early without loading the comments.
*/ */
if ( post_password_required() ) if ( post_password_required() ) {
return; return;
}
?> ?>
<div id="comments" class="comments-area"> <div id="comments" class="comments-area">

View File

@ -12,10 +12,11 @@
<a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>"> <a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
<?php <?php
if ( has_post_thumbnail() ) : if ( has_post_thumbnail() ) :
if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) {
the_post_thumbnail(); the_post_thumbnail();
else } else {
the_post_thumbnail( 'twentyfourteen-full-width' ); the_post_thumbnail( 'twentyfourteen-full-width' );
}
endif; endif;
?> ?>
</a> </a>

View File

@ -31,14 +31,16 @@
* *
* @since Twenty Fourteen 1.0 * @since Twenty Fourteen 1.0
*/ */
if ( ! isset( $content_width ) ) if ( ! isset( $content_width ) ) {
$content_width = 474; $content_width = 474;
}
/** /**
* Twenty Fourteen only works in WordPress 3.6 or later. * Twenty Fourteen only works in WordPress 3.6 or later.
*/ */
if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
require get_template_directory() . '/inc/back-compat.php'; require get_template_directory() . '/inc/back-compat.php';
}
if ( ! function_exists( 'twentyfourteen_setup' ) ) : if ( ! function_exists( 'twentyfourteen_setup' ) ) :
/** /**
@ -122,8 +124,9 @@ add_action( 'after_setup_theme', 'twentyfourteen_setup' );
* @return void * @return void
*/ */
function twentyfourteen_content_width() { function twentyfourteen_content_width() {
if ( is_attachment() && wp_attachment_is_image() ) if ( is_attachment() && wp_attachment_is_image() ) {
$GLOBALS['content_width'] = 810; $GLOBALS['content_width'] = 810;
}
} }
add_action( 'template_redirect', 'twentyfourteen_content_width' ); add_action( 'template_redirect', 'twentyfourteen_content_width' );
@ -203,8 +206,9 @@ function twentyfourteen_font_url() {
* Translators: If there are characters in your language that are not supported * Translators: If there are characters in your language that are not supported
* by Lato, translate this to 'off'. Do not translate into your own language. * by Lato, translate this to 'off'. Do not translate into your own language.
*/ */
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
$font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" ); $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" );
}
return $font_url; return $font_url;
} }
@ -230,14 +234,17 @@ function twentyfourteen_scripts() {
wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131110' ); wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131110' );
wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' );
}
if ( is_active_sidebar( 'sidebar-3' ) ) if ( is_active_sidebar( 'sidebar-3' ) ) {
wp_enqueue_script( 'jquery-masonry' ); wp_enqueue_script( 'jquery-masonry' );
}
if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131109', true ); wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131109', true );
@ -303,12 +310,14 @@ function twentyfourteen_the_attached_image() {
} }
// get the URL of the next image attachment... // get the URL of the next image attachment...
if ( $next_id ) if ( $next_id ) {
$next_attachment_url = get_attachment_link( $next_id ); $next_attachment_url = get_attachment_link( $next_id );
}
// or get the URL of the first image attachment. // or get the URL of the first image attachment.
else else {
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
}
} }
printf( '<a href="%1$s" rel="attachment">%2$s</a>', printf( '<a href="%1$s" rel="attachment">%2$s</a>',
@ -337,8 +346,9 @@ function twentyfourteen_list_authors() {
$post_count = count_user_posts( $contributor_id ); $post_count = count_user_posts( $contributor_id );
// Move on if user has not published a post (yet). // Move on if user has not published a post (yet).
if ( ! $post_count ) if ( ! $post_count ) {
continue; continue;
}
?> ?>
<div class="contributor"> <div class="contributor">
@ -379,33 +389,40 @@ endif;
* @return array The filtered body class list. * @return array The filtered body class list.
*/ */
function twentyfourteen_body_classes( $classes ) { function twentyfourteen_body_classes( $classes ) {
if ( is_multi_author() ) if ( is_multi_author() ) {
$classes[] = 'group-blog'; $classes[] = 'group-blog';
}
if ( get_header_image() ) if ( get_header_image() ) {
$classes[] = 'header-image'; $classes[] = 'header-image';
else } else {
$classes[] = 'masthead-fixed'; $classes[] = 'masthead-fixed';
}
if ( is_archive() || is_search() || is_home() ) if ( is_archive() || is_search() || is_home() ) {
$classes[] = 'list-view'; $classes[] = 'list-view';
}
if ( ( ! is_active_sidebar( 'sidebar-2' ) ) if ( ( ! is_active_sidebar( 'sidebar-2' ) )
|| is_page_template( 'page-templates/full-width.php' ) || is_page_template( 'page-templates/full-width.php' )
|| is_page_template( 'page-templates/contributors.php' ) || is_page_template( 'page-templates/contributors.php' )
|| is_attachment() ) || is_attachment() ) {
$classes[] = 'full-width'; $classes[] = 'full-width';
}
if ( is_active_sidebar( 'sidebar-3' ) ) if ( is_active_sidebar( 'sidebar-3' ) ) {
$classes[] = 'footer-widgets'; $classes[] = 'footer-widgets';
}
if ( is_singular() && ! is_front_page() ) if ( is_singular() && ! is_front_page() ) {
$classes[] = 'singular'; $classes[] = 'singular';
}
if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
$classes[] = 'slider'; $classes[] = 'slider';
elseif ( is_front_page() ) } elseif ( is_front_page() ) {
$classes[] = 'grid'; $classes[] = 'grid';
}
return $classes; return $classes;
} }
@ -423,8 +440,9 @@ add_filter( 'body_class', 'twentyfourteen_body_classes' );
* @return array The filtered post class list. * @return array The filtered post class list.
*/ */
function twentyfourteen_post_classes( $classes ) { function twentyfourteen_post_classes( $classes ) {
if ( ! post_password_required() && has_post_thumbnail() ) if ( ! post_password_required() && has_post_thumbnail() ) {
$classes[] = 'has-post-thumbnail'; $classes[] = 'has-post-thumbnail';
}
return $classes; return $classes;
} }
@ -443,20 +461,23 @@ add_filter( 'post_class', 'twentyfourteen_post_classes' );
function twentyfourteen_wp_title( $title, $sep ) { function twentyfourteen_wp_title( $title, $sep ) {
global $paged, $page; global $paged, $page;
if ( is_feed() ) if ( is_feed() ) {
return $title; return $title;
}
// Add the site name. // Add the site name.
$title .= get_bloginfo( 'name' ); $title .= get_bloginfo( 'name' );
// Add the site description for the home/front page. // Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' ); $site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) if ( $site_description && ( is_home() || is_front_page() ) ) {
$title = "$title $sep $site_description"; $title = "$title $sep $site_description";
}
// Add a page number if necessary. // Add a page number if necessary.
if ( $paged >= 2 || $page >= 2 ) if ( $paged >= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) );
}
return $title; return $title;
} }
@ -477,5 +498,6 @@ require get_template_directory() . '/inc/customizer.php';
* To overwrite in a plugin, define your own Featured_Content class on or * To overwrite in a plugin, define your own Featured_Content class on or
* before the 'setup_theme' hook. * before the 'setup_theme' hook.
*/ */
if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
require get_template_directory() . '/inc/featured-content.php'; require get_template_directory() . '/inc/featured-content.php';
}

View File

@ -97,10 +97,11 @@ function twentyfourteen_adjust_color( $color, $steps ) {
$hex = '#'; $hex = '#';
foreach ( $rgb as $value ) { foreach ( $rgb as $value ) {
$value += $steps; $value += $steps;
if ( $value > 255 ) if ( $value > 255 ) {
$value = 255; $value = 255;
elseif ( $value < 0 ) } elseif ( $value < 0 ) {
$value = 0; $value = 0;
}
$hex .= str_pad( dechex( $value ), 2, '0', STR_PAD_LEFT); $hex .= str_pad( dechex( $value ), 2, '0', STR_PAD_LEFT);
} }
@ -154,8 +155,9 @@ function twentyfourteen_customizer_styles() {
$accent_color = get_theme_mod( 'accent_color', '#24890d' ); $accent_color = get_theme_mod( 'accent_color', '#24890d' );
// Don't do anything if the current color is the default. // Don't do anything if the current color is the default.
if ( '#24890d' === $accent_color ) if ( '#24890d' === $accent_color ) {
return; return;
}
$accent_mid = get_theme_mod( 'accent_mid' ); $accent_mid = get_theme_mod( 'accent_mid' );
$accent_light = get_theme_mod( 'accent_light' ); $accent_light = get_theme_mod( 'accent_light' );

View File

@ -46,25 +46,29 @@ class Featured_Content {
$theme_support = get_theme_support( 'featured-content' ); $theme_support = get_theme_support( 'featured-content' );
// Return early if theme does not support Featured Content. // Return early if theme does not support Featured Content.
if ( ! $theme_support ) if ( ! $theme_support ) {
return; return;
}
/* /*
* An array of named arguments must be passed as the second parameter * An array of named arguments must be passed as the second parameter
* of add_theme_support(). * of add_theme_support().
*/ */
if ( ! isset( $theme_support[0] ) ) if ( ! isset( $theme_support[0] ) ) {
return; return;
}
// Return early if "featured_content_filter" has not been defined. // Return early if "featured_content_filter" has not been defined.
if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) {
return; return;
}
$filter = $theme_support[0]['featured_content_filter']; $filter = $theme_support[0]['featured_content_filter'];
// Theme can override the number of max posts. // Theme can override the number of max posts.
if ( isset( $theme_support[0]['max_posts'] ) ) if ( isset( $theme_support[0]['max_posts'] ) ) {
self::$max_posts = absint( $theme_support[0]['max_posts'] ); self::$max_posts = absint( $theme_support[0]['max_posts'] );
}
add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) ); add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) );
add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 ); add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 );
@ -100,8 +104,9 @@ class Featured_Content {
$post_ids = self::get_featured_post_ids(); $post_ids = self::get_featured_post_ids();
// No need to query if there is are no featured posts. // No need to query if there is are no featured posts.
if ( empty( $post_ids ) ) if ( empty( $post_ids ) ) {
return array(); return array();
}
$featured_posts = get_posts( array( $featured_posts = get_posts( array(
'include' => $post_ids, 'include' => $post_ids,
@ -124,17 +129,19 @@ class Featured_Content {
public static function get_featured_post_ids() { public static function get_featured_post_ids() {
// Return array of cached results if they exist. // Return array of cached results if they exist.
$featured_ids = get_transient( 'featured_content_ids' ); $featured_ids = get_transient( 'featured_content_ids' );
if ( ! empty( $featured_ids ) ) if ( ! empty( $featured_ids ) ) {
return array_map( 'absint', (array) $featured_ids ); return array_map( 'absint', (array) $featured_ids );
}
$settings = self::get_setting(); $settings = self::get_setting();
// Return sticky post ids if no tag name is set. // Return sticky post ids if no tag name is set.
$term = get_term_by( 'name', $settings['tag-name'], 'post_tag' ); $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' );
if ( $term ) if ( $term ) {
$tag = $term->term_id; $tag = $term->term_id;
else } else {
return self::get_sticky_posts(); return self::get_sticky_posts();
}
// Query for featured posts. // Query for featured posts.
$featured = get_posts( array( $featured = get_posts( array(
@ -149,8 +156,9 @@ class Featured_Content {
) ); ) );
// Return array with sticky posts if no Featured Content exists. // Return array with sticky posts if no Featured Content exists.
if ( ! $featured ) if ( ! $featured ) {
return self::get_sticky_posts(); return self::get_sticky_posts();
}
// Ensure correct format before save/return. // Ensure correct format before save/return.
$featured_ids = wp_list_pluck( (array) $featured, 'ID' ); $featured_ids = wp_list_pluck( (array) $featured, 'ID' );
@ -195,20 +203,23 @@ class Featured_Content {
public static function pre_get_posts( $query ) { public static function pre_get_posts( $query ) {
// Bail if not home or not main query. // Bail if not home or not main query.
if ( ! $query->is_home() || ! $query->is_main_query() ) if ( ! $query->is_home() || ! $query->is_main_query() ) {
return; return;
}
$page_on_front = get_option( 'page_on_front' ); $page_on_front = get_option( 'page_on_front' );
// Bail if the blog page is not the front page. // Bail if the blog page is not the front page.
if ( ! empty( $page_on_front ) ) if ( ! empty( $page_on_front ) ) {
return; return;
}
$featured = self::get_featured_post_ids(); $featured = self::get_featured_post_ids();
// Bail if no featured posts. // Bail if no featured posts.
if ( ! $featured ) if ( ! $featured ) {
return; return;
}
// We need to respect post ids already in the blacklist. // We need to respect post ids already in the blacklist.
$post__not_in = $query->get( 'post__not_in' ); $post__not_in = $query->get( 'post__not_in' );
@ -237,8 +248,9 @@ class Featured_Content {
public static function delete_post_tag( $tag_id ) { public static function delete_post_tag( $tag_id ) {
$settings = self::get_setting(); $settings = self::get_setting();
if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
return; return;
}
$settings['tag-id'] = 0; $settings['tag-id'] = 0;
$settings = self::validate_settings( $settings ); $settings = self::validate_settings( $settings );
@ -259,20 +271,24 @@ class Featured_Content {
public static function hide_featured_term( $terms, $taxonomies ) { public static function hide_featured_term( $terms, $taxonomies ) {
// This filter is only appropriate on the front-end. // This filter is only appropriate on the front-end.
if ( is_admin() ) if ( is_admin() ) {
return $terms; return $terms;
}
// We only want to hide the featured tag. // We only want to hide the featured tag.
if ( ! in_array( 'post_tag', $taxonomies ) ) if ( ! in_array( 'post_tag', $taxonomies ) ) {
return $terms; return $terms;
}
// Bail if no terms were returned. // Bail if no terms were returned.
if ( empty( $terms ) ) if ( empty( $terms ) ) {
return $terms; return $terms;
}
foreach( $terms as $order => $term ) { foreach( $terms as $order => $term ) {
if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) {
unset( $terms[ $order ] ); unset( $terms[ $order ] );
}
} }
return $terms; return $terms;
@ -293,20 +309,24 @@ class Featured_Content {
public static function hide_the_featured_term( $terms, $id, $taxonomy ) { public static function hide_the_featured_term( $terms, $id, $taxonomy ) {
// This filter is only appropriate on the front-end. // This filter is only appropriate on the front-end.
if ( is_admin() ) if ( is_admin() ) {
return $terms; return $terms;
}
// Make sure we are in the correct taxonomy. // Make sure we are in the correct taxonomy.
if ( 'post_tag' != $taxonomy ) if ( 'post_tag' != $taxonomy ) {
return $terms; return $terms;
}
// No terms? Return early! // No terms? Return early!
if ( empty( $terms ) ) if ( empty( $terms ) ) {
return $terms; return $terms;
}
foreach( $terms as $order => $term ) { foreach( $terms as $order => $term ) {
if ( self::get_setting( 'tag-id' ) == $term->term_id ) if ( self::get_setting( 'tag-id' ) == $term->term_id ) {
unset( $terms[ $term->term_id ] ); unset( $terms[ $term->term_id ] );
}
} }
return $terms; return $terms;
@ -401,8 +421,9 @@ class Featured_Content {
$options = array_intersect_key( $options, $defaults ); $options = array_intersect_key( $options, $defaults );
$options['quantity'] = self::sanitize_quantity( $options['quantity'] ); $options['quantity'] = self::sanitize_quantity( $options['quantity'] );
if ( 'all' != $key ) if ( 'all' != $key ) {
return isset( $options[ $key ] ) ? $options[ $key ] : false; return isset( $options[ $key ] ) ? $options[ $key ] : false;
}
return $options; return $options;
} }
@ -437,8 +458,9 @@ class Featured_Content {
$output['tag-name'] = $input['tag-name']; $output['tag-name'] = $input['tag-name'];
} }
if ( isset( $input['quantity'] ) ) if ( isset( $input['quantity'] ) ) {
$output['quantity'] = self::sanitize_quantity( $input['quantity'] ); $output['quantity'] = self::sanitize_quantity( $input['quantity'] );
}
$output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0; $output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0;
@ -458,10 +480,11 @@ class Featured_Content {
public static function sanitize_quantity( $input ) { public static function sanitize_quantity( $input ) {
$quantity = absint( $input ); $quantity = absint( $input );
if ( $quantity > self::$max_posts ) if ( $quantity > self::$max_posts ) {
$quantity = self::$max_posts; $quantity = self::$max_posts;
else if ( 1 > $quantity ) } else if ( 1 > $quantity ) {
$quantity = 1; $quantity = 1;
}
return $quantity; return $quantity;
} }

View File

@ -17,16 +17,18 @@ if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) :
*/ */
function twentyfourteen_paging_nav() { function twentyfourteen_paging_nav() {
// Don't print empty markup if there's only one page. // Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return; return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() ); $pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array(); $query_args = array();
$url_parts = explode( '?', $pagenum_link ); $url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args ); wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
@ -72,8 +74,9 @@ function twentyfourteen_post_nav() {
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false ); $next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) if ( ! $next && ! $previous ) {
return; return;
}
?> ?>
<nav class="navigation post-navigation" role="navigation"> <nav class="navigation post-navigation" role="navigation">
@ -102,8 +105,9 @@ if ( ! function_exists( 'twentyfourteen_posted_on' ) ) :
* @return void * @return void
*/ */
function twentyfourteen_posted_on() { function twentyfourteen_posted_on() {
if ( is_sticky() && is_home() && ! is_paged() ) if ( is_sticky() && is_home() && ! is_paged() ) {
echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>'; echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
}
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>', 'twentyfourteen' ), 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>', 'twentyfourteen' ),
esc_url( get_permalink() ), esc_url( get_permalink() ),
@ -167,18 +171,20 @@ add_action( 'save_post', 'twentyfourteen_category_transient_flusher' );
* @return void * @return void
*/ */
function twentyfourteen_post_thumbnail() { function twentyfourteen_post_thumbnail() {
if ( post_password_required() || ! has_post_thumbnail() ) if ( post_password_required() || ! has_post_thumbnail() ) {
return; return;
}
if ( is_singular() ) : if ( is_singular() ) :
?> ?>
<div class="post-thumbnail"> <div class="post-thumbnail">
<?php <?php
if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) {
the_post_thumbnail( 'twentyfourteen-full-width' ); the_post_thumbnail( 'twentyfourteen-full-width' );
else } else {
the_post_thumbnail(); the_post_thumbnail();
}
?> ?>
</div> </div>
@ -186,10 +192,11 @@ function twentyfourteen_post_thumbnail() {
<a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>"> <a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
<?php <?php
if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) {
the_post_thumbnail( 'twentyfourteen-full-width' ); the_post_thumbnail( 'twentyfourteen-full-width' );
else } else {
the_post_thumbnail(); the_post_thumbnail();
}
?> ?>
</a> </a>

View File

@ -231,8 +231,9 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
function update( $new_instance, $instance ) { function update( $new_instance, $instance ) {
$instance['title'] = strip_tags( $new_instance['title'] ); $instance['title'] = strip_tags( $new_instance['title'] );
$instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] ); $instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );
if ( in_array( $new_instance['format'], $this->formats ) ) if ( in_array( $new_instance['format'], $this->formats ) ) {
$instance['format'] = $new_instance['format']; $instance['format'] = $new_instance['format'];
}
$this->flush_widget_cache(); $this->flush_widget_cache();

View File

@ -18,8 +18,9 @@ get_header(); ?>
<div id="main-content" class="main-content"> <div id="main-content" class="main-content">
<?php <?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
get_template_part( 'featured-content' ); get_template_part( 'featured-content' );
}
?> ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">

View File

@ -12,8 +12,9 @@ get_header(); ?>
<div id="main-content" class="main-content"> <div id="main-content" class="main-content">
<?php <?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
get_template_part( 'featured-content' ); get_template_part( 'featured-content' );
}
?> ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
@ -35,8 +36,9 @@ get_header(); ?>
<?php <?php
// If comments are open or we have at least one comment, load up the comment template. // If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) if ( comments_open() || get_comments_number() ) {
comments_template(); comments_template();
}
endwhile; endwhile;
?> ?>
</div><!-- #content --> </div><!-- #content -->

View File

@ -12,8 +12,9 @@ get_header(); ?>
<div id="main-content" class="main-content"> <div id="main-content" class="main-content">
<?php <?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
get_template_part( 'featured-content' ); get_template_part( 'featured-content' );
}
?> ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
@ -25,8 +26,9 @@ get_header(); ?>
get_template_part( 'content', 'page' ); get_template_part( 'content', 'page' );
// If comments are open or we have at least one comment, load up the comment template. // If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) if ( comments_open() || get_comments_number() ) {
comments_template(); comments_template();
}
endwhile; endwhile;
?> ?>
</div><!-- #content --> </div><!-- #content -->

View File

@ -16,8 +16,9 @@ get_header(); ?>
<div id="main-content" class="main-content"> <div id="main-content" class="main-content">
<?php <?php
if ( is_front_page() && twentyfourteen_has_featured_posts() ) if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
get_template_part( 'featured-content' ); get_template_part( 'featured-content' );
}
?> ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
@ -29,8 +30,9 @@ get_header(); ?>
get_template_part( 'content', 'page' ); get_template_part( 'content', 'page' );
// If comments are open or we have at least one comment, load up the comment template. // If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) if ( comments_open() || get_comments_number() ) {
comments_template(); comments_template();
}
endwhile; endwhile;
?> ?>

View File

@ -7,8 +7,9 @@
* @since Twenty Fourteen 1.0 * @since Twenty Fourteen 1.0
*/ */
if ( ! is_active_sidebar( 'sidebar-2' ) ) if ( ! is_active_sidebar( 'sidebar-2' ) ) {
return; return;
}
?> ?>
<div id="content-sidebar" class="content-sidebar widget-area" role="complementary"> <div id="content-sidebar" class="content-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-2' ); ?> <?php dynamic_sidebar( 'sidebar-2' ); ?>

View File

@ -7,8 +7,9 @@
* @since Twenty Fourteen 1.0 * @since Twenty Fourteen 1.0
*/ */
if ( ! is_active_sidebar( 'sidebar-3' ) ) if ( ! is_active_sidebar( 'sidebar-3' ) ) {
return; return;
}
?> ?>
<div id="supplementary"> <div id="supplementary">

View File

@ -20,8 +20,9 @@ get_header(); ?>
twentyfourteen_post_nav(); twentyfourteen_post_nav();
// If comments are open or we have at least one comment, load up the comment template. // If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) if ( comments_open() || get_comments_number() ) {
comments_template(); comments_template();
}
endwhile; endwhile;
?> ?>
</div><!-- #content --> </div><!-- #content -->