Title: [202012] trunk/Websites/webkit.org
Revision
202012
Author
[email protected]
Date
2016-06-13 15:53:57 -0700 (Mon, 13 Jun 2016)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Websites/webkit.org/ChangeLog (202011 => 202012)


--- trunk/Websites/webkit.org/ChangeLog	2016-06-13 22:44:26 UTC (rev 202011)
+++ trunk/Websites/webkit.org/ChangeLog	2016-06-13 22:53:57 UTC (rev 202012)
@@ -1,3 +1,14 @@
+2016-06-13  Jon Davis  <[email protected]>
+
+        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  <[email protected]>
 
         Update the example for wider color gamut images.

Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php (202011 => 202012)


--- trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php	2016-06-13 22:44:26 UTC (rev 202011)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php	2016-06-13 22:53:57 UTC (rev 202012)
@@ -135,6 +135,23 @@
     $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();
 

Modified: trunk/Websites/webkit.org/wp-content/themes/webkit/style.css (202011 => 202012)


--- trunk/Websites/webkit.org/wp-content/themes/webkit/style.css	2016-06-13 22:44:26 UTC (rev 202011)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/style.css	2016-06-13 22:53:57 UTC (rev 202012)
@@ -1011,6 +1011,18 @@
     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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to