Ticket #26744: 26744.patch
File 26744.patch, 1.4 KB (added by , 11 years ago) |
---|
-
wp-content/themes/twentyfourteen/inc/featured-content.php
149 150 * 150 151 * @return array Array of post IDs. 151 152 */ 152 public static function get_featured_post_ids() {153 153 // Return array of cached results if they exist. 154 154 $featured_ids = get_transient( 'featured_content_ids' ); 155 if ( ! empty( $featured_ids ) ) { 156 return array_map( 'absint', (array) $featured_ids ); 155 if ( false !== $featured_ids ) { 156 if ( !empty( $featured_ids ) ) { 157 return array_map( 'absint', (array) $featured_ids ); 158 else { 159 return self::get_sticky_posts(); 160 } 157 161 } 158 162 159 163 $settings = self::get_setting(); … … 178 182 ), 179 183 ) ); 180 184 181 // Return array with sticky posts if no Featured Content exists.182 if ( ! $featured ) {183 return self::get_sticky_posts();184 }185 186 185 // Ensure correct format before save/return. 187 186 $featured_ids = wp_list_pluck( (array) $featured, 'ID' ); 188 187 $featured_ids = array_map( 'absint', $featured_ids ); 189 188 190 189 set_transient( 'featured_content_ids', $featured_ids ); 191 190 191 // Return array with sticky posts if no Featured Content exists. 192 if ( ! $featured ) { 193 return self::get_sticky_posts(); 194 } 195 192 196 return $featured_ids; 193 197 }