-
Notifications
You must be signed in to change notification settings - Fork 383
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
Support for landscape orientation #2409
Comments
Since the positions are already percentage-based, would there need to be any change? Granted, if you were making a
Being able to toggle between desktop and mobile aspect ratios is the key change here I think, if we don't maintain two separate layouts for each page.
Poster images for the stories should be fine as-is, since there is already a |
I created a test story: And I modified the diff --git a/includes/templates/single-amp_story.php b/includes/templates/single-amp_story.php
index 8d015ee7..d25db1d8 100644
--- a/includes/templates/single-amp_story.php
+++ b/includes/templates/single-amp_story.php
@@ -39,6 +39,7 @@ the_post();
$poster_landscape = wp_get_attachment_image_url( $thumbnail_id, AMP_Story_Post_Type::STORY_LANDSCAPE_IMAGE_SIZE );
?>
<amp-story
+ supports-landscape
standalone
publisher-logo-src="<?php echo esc_url( $publisher_logo_src ); ?>"
publisher="<?php echo esc_attr( $publisher ); ?>" When viewing in DevTools emulating as Pixel 2XL it looks as expected: And in desktop (1280x1024): So it's actually pretty good by default. That's the beauty of being mindful of the fundamentally responsive nature of stories. |
As suggested by @jdelia in #2448, what if we just started out with a toggle for whether the story should have the |
Thanks, @westonruter :) Perhaps if there was a setting in the plugin to enable |
@swissspidy What do you think of this: diff --git a/includes/templates/single-amp_story.php b/includes/templates/single-amp_story.php
index 8d015ee7..8f4600dd 100644
--- a/includes/templates/single-amp_story.php
+++ b/includes/templates/single-amp_story.php
@@ -40,6 +40,17 @@ the_post();
?>
<amp-story
standalone
+ <?php
+ /**
+ * Filters whether the story supports landscape.
+ *
+ * @param bool $supports_landscape Whether supports landscape. Currently false by default, but this will change in the future (e.g. via user toggle).
+ * @param wp_Post $post The current amp_story post object.
+ */
+ if ( apply_filters( 'amp_stories_supports_landscape', false, get_post() ) ) {
+ echo 'supports-landscape';
+ }
+ ?>
publisher-logo-src="<?php echo esc_url( $publisher_logo_src ); ?>"
publisher="<?php echo esc_attr( $publisher ); ?>"
title="<?php the_title_attribute(); ?>" A site could opt-in to landscape stories via just: add_filter( 'amp_stories_supports_landscape', '__return_true' ); I hesitate a bit with the default value. It's a similar story for In the same way, if someone forcibly applies a filter for |
That works for me. It's a good first step.
While a user toggle would influence that filter's default value, I don't think the filter should necessarily influence the toggle. But we can discuss the exact logic here at some other point in the future. |
With #3003 the |
Here's a plugin that allows you to force a story to support landscape even though we don't yet directly support it in the UI: https://gist.github.com/westonruter/4e4ee2b5790c6218fab40a7b3f90331f |
Eventually we need to add support for
supports-landscape
to support landscape orientation and a full bleed desktop experience. There have been user requests for this already too.Many things need to be considered for landscape support:
The text was updated successfully, but these errors were encountered: