-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return secondary amp mode if this post/page is a web story. #3619
Conversation
includes/Context.php
Outdated
// If the AMP plugin isn't enabled but this page/post is a web | ||
// story, use AMP Secondary mode. | ||
if ( is_singular( 'web-story' ) ) { | ||
return self::AMP_MODE_SECONDARY; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be conditional based on the AMP plugin, this should simply go before AMP plugin checks here like it does in the is_amp()
method above.
includes/Context.php
Outdated
@@ -324,6 +324,12 @@ public function is_amp() { | |||
*/ | |||
public function get_amp_mode() { | |||
if ( ! class_exists( 'AMP_Theme_Support' ) ) { | |||
// If the AMP plugin isn't enabled but this page/post is a web | |||
// story, use AMP Secondary mode. | |||
if ( is_singular( 'web-story' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tofumatt In addition to @aaemnnosttv's comment, per #2998 (comment) this shouldn't check whether the current context is a web story (which will never be the case in WP Admin), instead it needs to check whether the Web Stories plugin is active (e.g. check for whether the WEBSTORIES_VERSION
constant is defined (see https://github.com/google/web-stories-wp/blob/main/web-stories.php).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Summary
Addresses issue #2998.
Checklist