Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Set the status on the existing action hooks
Browse files Browse the repository at this point in the history
Rather than tracking down every place that might call
Instant_Articles_Post::to_instant_article and wrapping it call to set
the is_instant_article conditional, it's much simpler to just hook those
settings on the existing actions `instant_articles_before_transform_post`
and `instant_articles_after_transform_post`.
  • Loading branch information
goldenapples committed Dec 22, 2016
1 parent 8e54394 commit f81998e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions class-instant-articles-publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,8 @@ public static function submit_article( $post_id, $post ) {
return;
}

is_instant_article( true );

$article = $adapter->to_instant_article();

is_instant_article( false );

// Skip empty articles or articles missing title.
// This is important because the save_post action is also triggered by bulk updates, but in this case
// WordPress does not load the content field from DB for performance reasons. In this case, articles
Expand Down
4 changes: 2 additions & 2 deletions facebook-instant-articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,10 @@ function instant_articles_init() {
* @since 0.1
*/
function instant_articles_feed() {
is_instant_article( true );

// Load the feed template.
include( dirname( __FILE__ ) . '/feed-template.php' );

is_instant_article( false );
}

/**
Expand All @@ -174,6 +172,8 @@ function is_instant_article( $set_status = null ) {

return $is_instant_article;
}
add_action( 'instant_articles_before_transform_post', function() { is_instant_article( true ); } );
add_action( 'instant_articles_after_transform_post', function() { is_instant_article( false ); } );

/**
* Modify the main query for our feed.
Expand Down

0 comments on commit f81998e

Please sign in to comment.