Title: [229816] trunk/Websites/webkit.org
Revision
229816
Author
[email protected]
Date
2018-03-21 11:44:35 -0700 (Wed, 21 Mar 2018)

Log Message

Add support for an overridable byline in blog posts
https://bugs.webkit.org/show_bug.cgi?id=183799

Reviewed by Timothy Hatcher.

* wp-content/themes/webkit/functions.php:

Modified Paths

Diff

Modified: trunk/Websites/webkit.org/ChangeLog (229815 => 229816)


--- trunk/Websites/webkit.org/ChangeLog	2018-03-21 18:23:30 UTC (rev 229815)
+++ trunk/Websites/webkit.org/ChangeLog	2018-03-21 18:44:35 UTC (rev 229816)
@@ -1,3 +1,12 @@
+2018-03-21  Jon Davis  <[email protected]>
+
+        Add support for an overridable byline in blog posts
+        https://bugs.webkit.org/show_bug.cgi?id=183799
+
+        Reviewed by Timothy Hatcher.
+
+        * wp-content/themes/webkit/functions.php:
+
 2018-02-20  Jon Davis  <[email protected]>
 
         Add widescreen layout class for the Downloads page

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


--- trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php	2018-03-21 18:23:30 UTC (rev 229815)
+++ trunk/Websites/webkit.org/wp-content/themes/webkit/functions.php	2018-03-21 18:44:35 UTC (rev 229816)
@@ -102,7 +102,7 @@
 add_filter('the_title', function( $title ) {
     if ( is_admin() ) return $title;
     if ( is_feed() ) return $title;
-    
+
     $title = str_replace(": ", ": <br>", $title);
 
     $nowrap_strings = array();
@@ -114,7 +114,7 @@
         $nobreak = str_replace(" ", " ", trim($token));
         $title = str_replace(trim($token), $nobreak, $title);
     }
-    
+
     return $title;
 });
 
@@ -170,6 +170,13 @@
     $pages = array($post->post_content);
 });
 
+add_filter('the_author', function($display_name) {
+    $post = get_post();
+    if (!(is_single() || is_page())) return;
+    $byline = get_post_meta(get_the_ID(), 'byline', true);
+    return empty($byline) ? $display_name : $byline;
+});
+
 function before_the_title() {
     $post = get_post();
 
@@ -553,7 +560,7 @@
         } else {
             update_option(self::DATA_SETTING_NAME, $score);
         }
-        
+
         $httponly = false;
         $secure = false;
         setcookie(self::cookie_name(), 1, time() + YEAR_IN_SECONDS, '/', WP_HOST, $secure, $httponly );
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to