From 876210c444c05f140a6f735f7644e607529d0131 Mon Sep 17 00:00:00 2001 From: prcdevgitbot Date: Fri, 16 Feb 2024 23:49:30 +0000 Subject: [PATCH] See https://github.com/pewresearch/pewresearch-org/commit/5fac9504210469c2e4ffe9fa6e630a71232c703e from refs/heads/release/5.0 --- includes/apple-news/README.md | 2 +- includes/apple-news/class-apple-news.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/apple-news/README.md b/includes/apple-news/README.md index b3ac3b46..057c87fa 100644 --- a/includes/apple-news/README.md +++ b/includes/apple-news/README.md @@ -1,3 +1,3 @@ ## Apple News -- @TODO: Write instructions for adding Apple News support to your block +The Apple News class handles a few basic default settings and integrating specific platform modules, like Bylines, to the Apple News API. diff --git a/includes/apple-news/class-apple-news.php b/includes/apple-news/class-apple-news.php index 04b74b82..47cd75e7 100644 --- a/includes/apple-news/class-apple-news.php +++ b/includes/apple-news/class-apple-news.php @@ -34,7 +34,7 @@ public function init($loader = null) { } /** - * Returns bylines from our staff-bylines hybrid system. + * Returns bylines from our staff-bylines hybrid system for Apple News articles. * * @hook apple_news_exporter_byline * @@ -48,13 +48,16 @@ public function get_bylines($byline, $post_id) { } /** - * If the post is not on production, skip pushing to Apple News. + * If the post is not on production or is not published, skip pushing to Apple News. + * * @hook apple_news_skip_push + * * @param mixed $post_id * @return bool */ public function skip_push_on_non_prod_env($post_id) { - // @TODO Check post status, if its post_hidden, skip. - return 'production' !== wp_get_environment_type(); + // get the post status for $post_id + $post_status = get_post_status($post_id); + return 'publish' !== $post_status || 'production' !== wp_get_environment_type(); } }