Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@5fac950 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Feb 16, 2024
1 parent 49bd93c commit 876210c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion includes/apple-news/README.md
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 7 additions & 4 deletions includes/apple-news/class-apple-news.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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();
}
}

0 comments on commit 876210c

Please sign in to comment.