From 970dd3f3e80844d87683fc287861281fead0a44b Mon Sep 17 00:00:00 2001 From: Alexis Kulash Date: Wed, 26 Sep 2018 12:10:22 -0400 Subject: [PATCH 1/2] Add filter to modify Liveblog output location Fixes: #525 Some users would prefer having Liveblog output at the top of their posts rather than the bottom. This filter introduces the simple functionality to choose whether the Liveblog output should be above the content or below it (default). --- liveblog.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/liveblog.php b/liveblog.php index 6d0a20a82..a15319911 100644 --- a/liveblog.php +++ b/liveblog.php @@ -1169,6 +1169,10 @@ public static function add_liveblog_to_content( $content ) { $liveblog_output = '
'; $liveblog_output = apply_filters( 'liveblog_add_to_content', $liveblog_output, $content, self::$post_id ); + + if ( false === apply_filters( 'liveblog_output_at_bottom', true ) ) { + return wp_kses_post( $liveblog_output ) . $content; + } return $content . wp_kses_post( $liveblog_output ); } From d583e9a2343f3878474d06e682233a35cc663bf0 Mon Sep 17 00:00:00 2001 From: Alexis Kulash Date: Thu, 27 Sep 2018 15:45:56 -0400 Subject: [PATCH 2/2] Renaming filter to be less of a double-negative and more intuitive. If a user wants to place Liveblog output at the top of their post content, they can override the default false by having the filter 'liveblog_output_at_top' return true. --- liveblog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liveblog.php b/liveblog.php index a15319911..73ea6bdfb 100644 --- a/liveblog.php +++ b/liveblog.php @@ -1170,7 +1170,7 @@ public static function add_liveblog_to_content( $content ) { $liveblog_output = apply_filters( 'liveblog_add_to_content', $liveblog_output, $content, self::$post_id ); - if ( false === apply_filters( 'liveblog_output_at_bottom', true ) ) { + if ( true === apply_filters( 'liveblog_output_at_top', false ) ) { return wp_kses_post( $liveblog_output ) . $content; }