WordPress.org

Make WordPress Core

Ticket #26744: 26744.2.patch

File 26744.2.patch, 1.2 KB (added by Chouby, 16 months ago)
Line 
1Index: wp-content/themes/twentyfourteen/inc/featured-content.php
2===================================================================
3@@ -152,8 +153,12 @@
4        public static function get_featured_post_ids() {
5                // Return array of cached results if they exist.
6                $featured_ids = get_transient( 'featured_content_ids' );
7-               if ( ! empty( $featured_ids ) ) {
8-                       return array_map( 'absint', (array) $featured_ids );
9+               if ( false !== $featured_ids ) {
10+                       if ( !empty( $featured_ids ) ) {
11+                               return array_map( 'absint', (array) $featured_ids );
12+                       else {
13+                               return self::get_sticky_posts();
14+                       }
15                }
16 
17                $settings = self::get_setting();
18@@ -178,17 +183,17 @@
19                        ),
20                ) );
21 
22-               // Return array with sticky posts if no Featured Content exists.
23-               if ( ! $featured ) {
24-                       return self::get_sticky_posts();
25-               }
26-
27                // Ensure correct format before save/return.
28                $featured_ids = wp_list_pluck( (array) $featured, 'ID' );
29                $featured_ids = array_map( 'absint', $featured_ids );
30 
31                set_transient( 'featured_content_ids', $featured_ids );
32 
33+               // Return array with sticky posts if no Featured Content exists.
34+               if ( ! $featured ) {
35+                       return self::get_sticky_posts();
36+               }
37+
38                return $featured_ids;
39        }