Adds support for foreword custom meta and display styles on blog posts.
authorjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jun 2016 22:53:57 +0000 (22:53 +0000)
committerjond@apple.com <jond@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jun 2016 22:53:57 +0000 (22:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158707.

Reviewed by Timothy Hatcher.

* wp-content/themes/webkit/functions.php:
* wp-content/themes/webkit/style.css:
(article .foreword):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202012 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/style.css

index b99f709..7880c30 100644 (file)
@@ -1,3 +1,14 @@
+2016-06-13  Jon Davis  <jond@apple.com>
+
+        Adds support for foreword custom meta and display styles on blog posts.
+        https://bugs.webkit.org/show_bug.cgi?id=158707.
+
+        Reviewed by Timothy Hatcher.
+
+        * wp-content/themes/webkit/functions.php:
+        * wp-content/themes/webkit/style.css:
+        (article .foreword):
+
 2016-06-02  Dean Jackson  <dino@apple.com>
 
         Update the example for wider color gamut images.
index bfd43ef..37e8fb6 100644 (file)
@@ -135,6 +135,23 @@ add_action('the_post', function($post) {
     $pages = array($post->post_content);
 });
 
+add_action('the_post', function($post) {
+    global $pages;
+
+    if (!(is_single() || is_page())) return;
+
+    $foreword = get_post_meta(get_the_ID(), 'foreword', true);
+    if ( ! $foreword ) return;
+
+    $content = $post->post_content;
+    // Transform Markdown
+    $Markdown = WPCom_Markdown::get_instance();
+    $foreword = wp_unslash( $Markdown->transform($foreword) );
+    
+    $post->post_content = '<div class="foreword">' . $foreword . '</div>' . $content;
+    $pages = array($post->post_content);
+});
+
 function before_the_title() {
     $post = get_post();
 
index d866464..ad49927 100644 (file)
@@ -1011,6 +1011,18 @@ article div.note {
     box-sizing: normal;
 }
 
+article .foreword {
+    padding: 3rem;
+    background-color: #f0f0f0;
+    border: 1px solid #e6e6e6;
+    color: #8E8E93;
+    border-radius: 3px;
+    margin-bottom: 3rem;
+    box-sizing: normal;
+    font-size: 1.6rem;
+    font-style: italic;
+}
+
 article .two-columns {
     columns: 2;
     column-gap: 6rem;