From ab8dcac01adc49d9cc96ae31875695ed45e7cbf6 Mon Sep 17 00:00:00 2001 From: Christian Chung Date: Tue, 30 Oct 2018 13:46:14 -0400 Subject: [PATCH 1/4] Add liveblog_amp_facebook_share_app_id filter --- classes/class-wpcom-liveblog-amp.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/classes/class-wpcom-liveblog-amp.php b/classes/class-wpcom-liveblog-amp.php index 83dc004df..f285b5ec5 100644 --- a/classes/class-wpcom-liveblog-amp.php +++ b/classes/class-wpcom-liveblog-amp.php @@ -88,7 +88,14 @@ public static function add_custom_query_vars( $query_vars ) { public static function add_social_share_options() { $social_array = array( 'twitter', 'pinterest', 'email', 'gplus' ); - if ( defined( 'LIVEBLOG_AMP_FACEBOOK_SHARE' ) ) { + /** + * Filter Liveblog AMP Facebook share app id + * + * @param string $app_id The Facebook application id to enable sharing to Facebook. + */ + $facebook_app_id = apply_filters( 'liveblog_amp_facebook_share_app_id', '' ); + + if ( ! empty( $facebook_app_id ) ) { $social_array[] = 'facebook'; } From 0a5c7ce334208614abb199d88b9388dc82bd1b7b Mon Sep 17 00:00:00 2001 From: Christian Chung Date: Tue, 30 Oct 2018 13:51:05 -0400 Subject: [PATCH 2/4] Add support for outputting Facebook app id in entry template --- templates/amp/entry.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/amp/entry.php b/templates/amp/entry.php index 073a43922..a151470c7 100644 --- a/templates/amp/entry.php +++ b/templates/amp/entry.php @@ -7,6 +7,9 @@ $share_link = $this->get( 'share_link' ); $update_time = $this->get( 'update_time' ); $share_link_amp = $this->get( 'share_link_amp' ); + + /* This filter is defined in class-wpcom-liveblog-amp.php */ + $facebook_app_id = apply_filters( 'liveblog_amp_facebook_share_app_id', '' ); ?>
+ data-param-url="" + + data-param-app_id="" + + >
From cd1fd6074ca838dba3bdb19ba147dd5f72d0fbf2 Mon Sep 17 00:00:00 2001 From: Christian Chung Date: Tue, 30 Oct 2018 14:18:36 -0400 Subject: [PATCH 3/4] Use boolean false as the default facebook share app id --- classes/class-wpcom-liveblog-amp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/class-wpcom-liveblog-amp.php b/classes/class-wpcom-liveblog-amp.php index f285b5ec5..66114cb6c 100644 --- a/classes/class-wpcom-liveblog-amp.php +++ b/classes/class-wpcom-liveblog-amp.php @@ -91,9 +91,9 @@ public static function add_social_share_options() { /** * Filter Liveblog AMP Facebook share app id * - * @param string $app_id The Facebook application id to enable sharing to Facebook. + * @param mixed $app_id Facebook app id to enable Facebook sharing, default false. */ - $facebook_app_id = apply_filters( 'liveblog_amp_facebook_share_app_id', '' ); + $facebook_app_id = apply_filters( 'liveblog_amp_facebook_share_app_id', false ); if ( ! empty( $facebook_app_id ) ) { $social_array[] = 'facebook'; From 1fb26ec490ffbe3fb15237dbf3cceca0675ed09a Mon Sep 17 00:00:00 2001 From: Christian Chung Date: Tue, 30 Oct 2018 14:19:27 -0400 Subject: [PATCH 4/4] Use boolean false as the default facebook share app id in template --- templates/amp/entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/amp/entry.php b/templates/amp/entry.php index a151470c7..5db097f2e 100644 --- a/templates/amp/entry.php +++ b/templates/amp/entry.php @@ -9,7 +9,7 @@ $share_link_amp = $this->get( 'share_link_amp' ); /* This filter is defined in class-wpcom-liveblog-amp.php */ - $facebook_app_id = apply_filters( 'liveblog_amp_facebook_share_app_id', '' ); + $facebook_app_id = apply_filters( 'liveblog_amp_facebook_share_app_id', false ); ?>