Changeset 26260
- Timestamp:
- 11/18/2013 11:11:01 PM (11 years ago)
- Location:
- trunk/src/wp-content/themes/twentyfourteen
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/comments.php
r25769 r26260 14 14 * entered the password we will return early without loading the comments. 15 15 */ 16 if ( post_password_required() ) 16 if ( post_password_required() ) { 17 17 return; 18 } 18 19 ?> 19 20 -
trunk/src/wp-content/themes/twentyfourteen/content-featured-post.php
r26152 r26260 13 13 <?php 14 14 if ( has_post_thumbnail() ) : 15 if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) 15 if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) { 16 16 the_post_thumbnail(); 17 else17 } else { 18 18 the_post_thumbnail( 'twentyfourteen-full-width' ); 19 } 19 20 endif; 20 21 ?> -
trunk/src/wp-content/themes/twentyfourteen/functions.php
r26249 r26260 32 32 * @since Twenty Fourteen 1.0 33 33 */ 34 if ( ! isset( $content_width ) ) 34 if ( ! isset( $content_width ) ) { 35 35 $content_width = 474; 36 } 36 37 37 38 /** 38 39 * Twenty Fourteen only works in WordPress 3.6 or later. 39 40 */ 40 if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) 41 if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) { 41 42 require get_template_directory() . '/inc/back-compat.php'; 43 } 42 44 43 45 if ( ! function_exists( 'twentyfourteen_setup' ) ) : … … 123 125 */ 124 126 function twentyfourteen_content_width() { 125 if ( is_attachment() && wp_attachment_is_image() ) 127 if ( is_attachment() && wp_attachment_is_image() ) { 126 128 $GLOBALS['content_width'] = 810; 129 } 127 130 } 128 131 add_action( 'template_redirect', 'twentyfourteen_content_width' ); … … 204 207 * by Lato, translate this to 'off'. Do not translate into your own language. 205 208 */ 206 if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) 209 if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { 207 210 $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" ); 211 } 208 212 209 213 return $font_url; … … 231 235 wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); 232 236 233 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) 237 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 234 238 wp_enqueue_script( 'comment-reply' ); 235 236 if ( is_singular() && wp_attachment_is_image() ) 239 } 240 241 if ( is_singular() && wp_attachment_is_image() ) { 237 242 wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); 238 239 if ( is_active_sidebar( 'sidebar-3' ) ) 243 } 244 245 if ( is_active_sidebar( 'sidebar-3' ) ) { 240 246 wp_enqueue_script( 'jquery-masonry' ); 247 } 241 248 242 249 if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { … … 304 311 305 312 // get the URL of the next image attachment... 306 if ( $next_id ) 313 if ( $next_id ) { 307 314 $next_attachment_url = get_attachment_link( $next_id ); 315 } 308 316 309 317 // or get the URL of the first image attachment. 310 else 318 else { 311 319 $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); 320 } 312 321 } 313 322 … … 338 347 339 348 // Move on if user has not published a post (yet). 340 if ( ! $post_count ) 349 if ( ! $post_count ) { 341 350 continue; 351 } 342 352 ?> 343 353 … … 380 390 */ 381 391 function twentyfourteen_body_classes( $classes ) { 382 if ( is_multi_author() ) 392 if ( is_multi_author() ) { 383 393 $classes[] = 'group-blog'; 384 385 if ( get_header_image() ) 394 } 395 396 if ( get_header_image() ) { 386 397 $classes[] = 'header-image'; 387 else398 } else { 388 399 $classes[] = 'masthead-fixed'; 389 390 if ( is_archive() || is_search() || is_home() ) 400 } 401 402 if ( is_archive() || is_search() || is_home() ) { 391 403 $classes[] = 'list-view'; 404 } 392 405 393 406 if ( ( ! is_active_sidebar( 'sidebar-2' ) ) 394 407 || is_page_template( 'page-templates/full-width.php' ) 395 408 || is_page_template( 'page-templates/contributors.php' ) 396 || is_attachment() ) 409 || is_attachment() ) { 397 410 $classes[] = 'full-width'; 398 399 if ( is_active_sidebar( 'sidebar-3' ) ) 411 } 412 413 if ( is_active_sidebar( 'sidebar-3' ) ) { 400 414 $classes[] = 'footer-widgets'; 401 402 if ( is_singular() && ! is_front_page() ) 415 } 416 417 if ( is_singular() && ! is_front_page() ) { 403 418 $classes[] = 'singular'; 404 405 if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) 419 } 420 421 if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { 406 422 $classes[] = 'slider'; 407 elseif ( is_front_page() )423 } elseif ( is_front_page() ) { 408 424 $classes[] = 'grid'; 425 } 409 426 410 427 return $classes; … … 424 441 */ 425 442 function twentyfourteen_post_classes( $classes ) { 426 if ( ! post_password_required() && has_post_thumbnail() ) 443 if ( ! post_password_required() && has_post_thumbnail() ) { 427 444 $classes[] = 'has-post-thumbnail'; 445 } 428 446 429 447 return $classes; … … 444 462 global $paged, $page; 445 463 446 if ( is_feed() ) 464 if ( is_feed() ) { 447 465 return $title; 466 } 448 467 449 468 // Add the site name. … … 452 471 // Add the site description for the home/front page. 453 472 $site_description = get_bloginfo( 'description', 'display' ); 454 if ( $site_description && ( is_home() || is_front_page() ) ) 473 if ( $site_description && ( is_home() || is_front_page() ) ) { 455 474 $title = "$title $sep $site_description"; 475 } 456 476 457 477 // Add a page number if necessary. 458 if ( $paged >= 2 || $page >= 2 ) 478 if ( $paged >= 2 || $page >= 2 ) { 459 479 $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); 480 } 460 481 461 482 return $title; … … 478 499 * before the 'setup_theme' hook. 479 500 */ 480 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) 501 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { 481 502 require get_template_directory() . '/inc/featured-content.php'; 503 } -
trunk/src/wp-content/themes/twentyfourteen/inc/customizer.php
r26227 r26260 98 98 foreach ( $rgb as $value ) { 99 99 $value += $steps; 100 if ( $value > 255 ) 100 if ( $value > 255 ) { 101 101 $value = 255; 102 elseif ( $value < 0 )102 } elseif ( $value < 0 ) { 103 103 $value = 0; 104 } 104 105 $hex .= str_pad( dechex( $value ), 2, '0', STR_PAD_LEFT); 105 106 } … … 155 156 156 157 // Don't do anything if the current color is the default. 157 if ( '#24890d' === $accent_color ) 158 if ( '#24890d' === $accent_color ) { 158 159 return; 160 } 159 161 160 162 $accent_mid = get_theme_mod( 'accent_mid' ); -
trunk/src/wp-content/themes/twentyfourteen/inc/featured-content.php
r26257 r26260 47 47 48 48 // Return early if theme does not support Featured Content. 49 if ( ! $theme_support ) 50 return; 49 if ( ! $theme_support ) { 50 return; 51 } 51 52 52 53 /* … … 54 55 * of add_theme_support(). 55 56 */ 56 if ( ! isset( $theme_support[0] ) ) 57 return; 57 if ( ! isset( $theme_support[0] ) ) { 58 return; 59 } 58 60 59 61 // Return early if "featured_content_filter" has not been defined. 60 if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) 61 return; 62 if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) { 63 return; 64 } 62 65 63 66 $filter = $theme_support[0]['featured_content_filter']; 64 67 65 68 // Theme can override the number of max posts. 66 if ( isset( $theme_support[0]['max_posts'] ) ) 69 if ( isset( $theme_support[0]['max_posts'] ) ) { 67 70 self::$max_posts = absint( $theme_support[0]['max_posts'] ); 71 } 68 72 69 73 add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) ); … … 101 105 102 106 // No need to query if there is are no featured posts. 103 if ( empty( $post_ids ) ) 107 if ( empty( $post_ids ) ) { 104 108 return array(); 109 } 105 110 106 111 $featured_posts = get_posts( array( … … 125 130 // Return array of cached results if they exist. 126 131 $featured_ids = get_transient( 'featured_content_ids' ); 127 if ( ! empty( $featured_ids ) ) 132 if ( ! empty( $featured_ids ) ) { 128 133 return array_map( 'absint', (array) $featured_ids ); 134 } 129 135 130 136 $settings = self::get_setting(); … … 132 138 // Return sticky post ids if no tag name is set. 133 139 $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' ); 134 if ( $term ) 140 if ( $term ) { 135 141 $tag = $term->term_id; 136 else142 } else { 137 143 return self::get_sticky_posts(); 144 } 138 145 139 146 // Query for featured posts. … … 150 157 151 158 // Return array with sticky posts if no Featured Content exists. 152 if ( ! $featured ) 159 if ( ! $featured ) { 153 160 return self::get_sticky_posts(); 161 } 154 162 155 163 // Ensure correct format before save/return. … … 196 204 197 205 // Bail if not home or not main query. 198 if ( ! $query->is_home() || ! $query->is_main_query() ) 199 return; 206 if ( ! $query->is_home() || ! $query->is_main_query() ) { 207 return; 208 } 200 209 201 210 $page_on_front = get_option( 'page_on_front' ); 202 211 203 212 // Bail if the blog page is not the front page. 204 if ( ! empty( $page_on_front ) ) 205 return; 213 if ( ! empty( $page_on_front ) ) { 214 return; 215 } 206 216 207 217 $featured = self::get_featured_post_ids(); 208 218 209 219 // Bail if no featured posts. 210 if ( ! $featured ) 211 return; 220 if ( ! $featured ) { 221 return; 222 } 212 223 213 224 // We need to respect post ids already in the blacklist. … … 238 249 $settings = self::get_setting(); 239 250 240 if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) 241 return; 251 if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) { 252 return; 253 } 242 254 243 255 $settings['tag-id'] = 0; … … 260 272 261 273 // This filter is only appropriate on the front-end. 262 if ( is_admin() ) 263 return $terms; 274 if ( is_admin() ) { 275 return $terms; 276 } 264 277 265 278 // We only want to hide the featured tag. 266 if ( ! in_array( 'post_tag', $taxonomies ) ) 267 return $terms; 279 if ( ! in_array( 'post_tag', $taxonomies ) ) { 280 return $terms; 281 } 268 282 269 283 // Bail if no terms were returned. 270 if ( empty( $terms ) ) 271 return $terms; 284 if ( empty( $terms ) ) { 285 return $terms; 286 } 272 287 273 288 foreach( $terms as $order => $term ) { 274 if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) 289 if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) { 275 290 unset( $terms[ $order ] ); 291 } 276 292 } 277 293 … … 294 310 295 311 // This filter is only appropriate on the front-end. 296 if ( is_admin() ) 297 return $terms; 312 if ( is_admin() ) { 313 return $terms; 314 } 298 315 299 316 // Make sure we are in the correct taxonomy. 300 if ( 'post_tag' != $taxonomy ) 301 return $terms; 317 if ( 'post_tag' != $taxonomy ) { 318 return $terms; 319 } 302 320 303 321 // No terms? Return early! 304 if ( empty( $terms ) ) 305 return $terms; 322 if ( empty( $terms ) ) { 323 return $terms; 324 } 306 325 307 326 foreach( $terms as $order => $term ) { 308 if ( self::get_setting( 'tag-id' ) == $term->term_id ) 327 if ( self::get_setting( 'tag-id' ) == $term->term_id ) { 309 328 unset( $terms[ $term->term_id ] ); 329 } 310 330 } 311 331 … … 402 422 $options['quantity'] = self::sanitize_quantity( $options['quantity'] ); 403 423 404 if ( 'all' != $key ) 424 if ( 'all' != $key ) { 405 425 return isset( $options[ $key ] ) ? $options[ $key ] : false; 426 } 406 427 407 428 return $options; … … 438 459 } 439 460 440 if ( isset( $input['quantity'] ) ) 461 if ( isset( $input['quantity'] ) ) { 441 462 $output['quantity'] = self::sanitize_quantity( $input['quantity'] ); 463 } 442 464 443 465 $output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0; … … 459 481 $quantity = absint( $input ); 460 482 461 if ( $quantity > self::$max_posts ) 483 if ( $quantity > self::$max_posts ) { 462 484 $quantity = self::$max_posts; 463 else if ( 1 > $quantity )485 } else if ( 1 > $quantity ) { 464 486 $quantity = 1; 487 } 465 488 466 489 return $quantity; -
trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php
r26227 r26260 18 18 function twentyfourteen_paging_nav() { 19 19 // Don't print empty markup if there's only one page. 20 if ( $GLOBALS['wp_query']->max_num_pages < 2 ) 20 if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { 21 21 return; 22 } 22 23 23 24 $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; … … 26 27 $url_parts = explode( '?', $pagenum_link ); 27 28 28 if ( isset( $url_parts[1] ) ) 29 if ( isset( $url_parts[1] ) ) { 29 30 wp_parse_str( $url_parts[1], $query_args ); 31 } 30 32 31 33 $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); … … 73 75 $next = get_adjacent_post( false, '', false ); 74 76 75 if ( ! $next && ! $previous ) 77 if ( ! $next && ! $previous ) { 76 78 return; 79 } 77 80 78 81 ?> … … 103 106 */ 104 107 function twentyfourteen_posted_on() { 105 if ( is_sticky() && is_home() && ! is_paged() ) 108 if ( is_sticky() && is_home() && ! is_paged() ) { 106 109 echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>'; 110 } 107 111 108 112 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' ), … … 168 172 */ 169 173 function twentyfourteen_post_thumbnail() { 170 if ( post_password_required() || ! has_post_thumbnail() ) 174 if ( post_password_required() || ! has_post_thumbnail() ) { 171 175 return; 176 } 172 177 173 178 if ( is_singular() ) : … … 176 181 <div class="post-thumbnail"> 177 182 <?php 178 if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) 183 if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) { 179 184 the_post_thumbnail( 'twentyfourteen-full-width' ); 180 else185 } else { 181 186 the_post_thumbnail(); 187 } 182 188 ?> 183 189 </div> … … 187 193 <a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>"> 188 194 <?php 189 if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) 195 if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) { 190 196 the_post_thumbnail( 'twentyfourteen-full-width' ); 191 else197 } else { 192 198 the_post_thumbnail(); 199 } 193 200 ?> 194 201 </a> -
trunk/src/wp-content/themes/twentyfourteen/inc/widgets.php
r26225 r26260 232 232 $instance['title'] = strip_tags( $new_instance['title'] ); 233 233 $instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] ); 234 if ( in_array( $new_instance['format'], $this->formats ) ) 234 if ( in_array( $new_instance['format'], $this->formats ) ) { 235 235 $instance['format'] = $new_instance['format']; 236 } 236 237 237 238 $this->flush_widget_cache(); -
trunk/src/wp-content/themes/twentyfourteen/index.php
r25985 r26260 19 19 20 20 <?php 21 if ( is_front_page() && twentyfourteen_has_featured_posts() ) 21 if ( is_front_page() && twentyfourteen_has_featured_posts() ) { 22 22 get_template_part( 'featured-content' ); 23 } 23 24 ?> 24 25 -
trunk/src/wp-content/themes/twentyfourteen/page-templates/contributors.php
r26105 r26260 13 13 14 14 <?php 15 if ( is_front_page() && twentyfourteen_has_featured_posts() ) 15 if ( is_front_page() && twentyfourteen_has_featured_posts() ) { 16 16 get_template_part( 'featured-content' ); 17 } 17 18 ?> 18 19 … … 36 37 <?php 37 38 // If comments are open or we have at least one comment, load up the comment template. 38 if ( comments_open() || get_comments_number() ) 39 if ( comments_open() || get_comments_number() ) { 39 40 comments_template(); 41 } 40 42 endwhile; 41 43 ?> -
trunk/src/wp-content/themes/twentyfourteen/page-templates/full-width.php
r26105 r26260 13 13 14 14 <?php 15 if ( is_front_page() && twentyfourteen_has_featured_posts() ) 15 if ( is_front_page() && twentyfourteen_has_featured_posts() ) { 16 16 get_template_part( 'featured-content' ); 17 } 17 18 ?> 18 19 … … 26 27 27 28 // If comments are open or we have at least one comment, load up the comment template. 28 if ( comments_open() || get_comments_number() ) 29 if ( comments_open() || get_comments_number() ) { 29 30 comments_template(); 31 } 30 32 endwhile; 31 33 ?> -
trunk/src/wp-content/themes/twentyfourteen/page.php
r25985 r26260 17 17 18 18 <?php 19 if ( is_front_page() && twentyfourteen_has_featured_posts() ) 19 if ( is_front_page() && twentyfourteen_has_featured_posts() ) { 20 20 get_template_part( 'featured-content' ); 21 } 21 22 ?> 22 23 <div id="primary" class="content-area"> … … 30 31 31 32 // If comments are open or we have at least one comment, load up the comment template. 32 if ( comments_open() || get_comments_number() ) 33 if ( comments_open() || get_comments_number() ) { 33 34 comments_template(); 35 } 34 36 endwhile; 35 37 ?> -
trunk/src/wp-content/themes/twentyfourteen/sidebar-content.php
r26227 r26260 8 8 */ 9 9 10 if ( ! is_active_sidebar( 'sidebar-2' ) ) 10 if ( ! is_active_sidebar( 'sidebar-2' ) ) { 11 11 return; 12 } 12 13 ?> 13 14 <div id="content-sidebar" class="content-sidebar widget-area" role="complementary"> -
trunk/src/wp-content/themes/twentyfourteen/sidebar-footer.php
r25769 r26260 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 -
trunk/src/wp-content/themes/twentyfourteen/single.php
r26217 r26260 21 21 22 22 // If comments are open or we have at least one comment, load up the comment template. 23 if ( comments_open() || get_comments_number() ) 23 if ( comments_open() || get_comments_number() ) { 24 24 comments_template(); 25 } 25 26 endwhile; 26 27 ?>
Note: See TracChangeset
for help on using the changeset viewer.