Reduce Safari Technology Preview Release Notes posts shown on homepage
authorjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 May 2017 18:57:12 +0000 (18:57 +0000)
committerjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 May 2017 18:57:12 +0000 (18:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172364

Reviewed by Daniel Bates.

* wp-content/themes/webkit/functions.php: Load some extra posts.
* wp-content/themes/webkit/widgets/post.php: Show STP blog posts when it is the current featured post.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217614 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/webkit.org/ChangeLog
Websites/webkit.org/wp-content/themes/webkit/functions.php
Websites/webkit.org/wp-content/themes/webkit/widgets/post.php

index f1d86c4..78d9370 100644 (file)
@@ -1,3 +1,13 @@
+2017-05-31  Jon Davis  <jond@apple.com>
+
+        Reduce Safari Technology Preview Release Notes posts shown on homepage
+        https://bugs.webkit.org/show_bug.cgi?id=172364
+
+        Reviewed by Daniel Bates.
+
+        * wp-content/themes/webkit/functions.php: Load some extra posts.
+        * wp-content/themes/webkit/widgets/post.php: Show STP blog posts when it is the current featured post.
+
 2017-05-18  Jon Davis  <jond@apple.com>
 
         Add an Accessibility icon to webkit.org
index 5c2f65b..25ffcef 100644 (file)
@@ -419,7 +419,7 @@ class Front_Page_Posts {
             self::$object = new self;
 
         if ( empty(self::$wp_query) )
-            self::$wp_query = new WP_Query(array('post_type' => 'post'));
+            self::$wp_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 16));
 
         return self::$object;
     }
index d99e70b..e66f078 100644 (file)
@@ -22,14 +22,23 @@ class WebKitPostTileWidget extends WP_Widget {
     }
 
     public function widget( array $args, array $options ) {
-        
         $Query = $this->load($options);
         
         // Get the next post, if available     
         if ( ! $Query->have_posts() ) return;
+
         // Queue the post data
         $Query->the_post();
 
+        $featured = ( 'on' == $options['featured'] );
+        if ( ! $featured ) {
+            // Prevent Safari Technology Preview release note posts from showing up when not a featured post.
+            while ( in_category('safari-technology-preview') && $Query->have_posts() ) {
+                $Query->the_post();
+                continue;
+            }
+        }
+
         if ( ! empty($args) )
             extract($args, EXTR_SKIP);
         
@@ -40,12 +49,9 @@ class WebKitPostTileWidget extends WP_Widget {
         $image = '';
         if ( $post_thumbnail_id = get_post_thumbnail_id() ) {
             $post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );
-            // $image = " style=\"background-image: url('" . $post_thumbnail_url . "')\"";
             $image = " data-url=\"" . $post_thumbnail_url . "\"";
         }
         
-        $featured = ( 'on' == $options['featured'] );
-        
         $classes = array('tile');
         if ( $featured ) {
             $classes[] = 'featured-tile';
@@ -90,7 +96,6 @@ class WebKitPostTileWidget extends WP_Widget {
             <input type="checkbox" name="<?php echo $this->get_field_name('featured'); ?>" id="<?php echo $this->get_field_id('featured'); ?>" class="widefat" value="on" <?php echo ( 'on' == $options['featured'] ) ? 'checked' : ''; ?>>
             <?php _e('Featured'); ?></label>
                </p>
-        
                <?php
     }