Skip to content
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

Merged
merged 3 commits into from
Jun 30, 2021

Conversation

tofumatt
Copy link
Collaborator

Summary

Addresses issue #2998.

Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 4.7 and PHP 5.6.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Comment on lines 327 to 332
// 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;
}

Copy link
Collaborator

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.

@@ -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' ) ) {
Copy link
Member

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).

@tofumatt tofumatt changed the base branch from develop to main June 29, 2021 19:11
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@felixarntz felixarntz merged commit 50e03f0 into main Jun 30, 2021
@felixarntz felixarntz deleted the amp-fixes-web-stories-2998 branch June 30, 2021 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants