Changeset 25808
- Timestamp:
- 10/16/2013 04:21:10 AM (11 years ago)
- Location:
- trunk/src/wp-content/themes/twentyfourteen
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/functions.php
r25804 r25808 103 103 104 104 /* 105 * Add support for featured content. 106 */ 107 add_theme_support( 'featured-content', array( 108 'featured_content_filter' => 'twentyfourteen_get_featured_posts', 109 'max_posts' => 6, 110 ) ); 111 112 /* 105 113 * This theme uses its own gallery styles. 106 114 */ … … 127 135 * 128 136 * @since Twenty Fourteen 1.0 137 * 138 * @return array An array of WP_Post objects. 129 139 */ 130 140 function twentyfourteen_get_featured_posts() { 131 return apply_filters( 'twentyfourteen_get_featured_posts', false ); 132 } 133 134 /** 135 * A helper conditional function that returns a boolean value 136 * So that we can use a condition like 137 * if ( twentyfourteen_has_featured_posts( 1 ) ) 138 * 139 * @since Twenty Fourteen 1.0 140 */ 141 function twentyfourteen_has_featured_posts( $minimum = 1 ) { 142 if ( is_paged() ) 143 return false; 144 145 $featured_posts = apply_filters( 'twentyfourteen_get_featured_posts', array() ); 146 147 return is_array( $featured_posts ) && count( $featured_posts ) > absint( $minimum ); 141 return apply_filters( 'twentyfourteen_get_featured_posts', array() ); 142 } 143 144 /** 145 * A helper conditional function that returns a boolean value. 146 * 147 * @since Twenty Fourteen 1.0 148 * 149 * @return bool Whether there are featured posts. 150 */ 151 function twentyfourteen_has_featured_posts() { 152 return ! is_paged() && (bool) apply_filters( 'twentyfourteen_get_featured_posts', false ); 148 153 } 149 154 … … 353 358 354 359 /** 355 * Get recent formatted posts that are not featured in F C plugin.360 * Get recent formatted posts that are not featured in Featured Content area. 356 361 * 357 362 * @since Twenty Fourteen 1.0 … … 522 527 // Add Theme Customizer functionality. 523 528 require get_template_directory() . '/inc/customizer.php'; 529 530 /* 531 * Add Featured Content functionality. 532 * 533 * To overwrite in a plugin, define your own Featured_Content class on or 534 * before the 'setup_theme' hook. 535 */ 536 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) 537 require get_template_directory() . '/inc/featured-content.php';
Note: See TracChangeset
for help on using the changeset viewer.