This repository was archived by the owner on Sep 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add AMP theme support #1286
Open
westonruter
wants to merge
6
commits into
Automattic:master
Choose a base branch
from
xwp:amp-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add AMP theme support #1286
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1791783
Add AMP theme support
westonruter b4d24c2
Fix phpcs errors unrelated to AMP changes
westonruter 5f31822
Restore use of button for menu-toggle in AMP
westonruter 0ec1648
Simplify state for siteNavigationMenu
westonruter ebed1b3
Remove amp theme support in favor of letting user opt-in via admin
westonruter 0c8d535
Remove implementation of comments_live_list for now
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
<html <?php language_attributes(); ?>> | ||
<head> | ||
<meta charset="<?php bloginfo( 'charset' ); ?>"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> | ||
<link rel="profile" href="https://gmpg.org/xfn/11"> | ||
|
||
<?php wp_head(); ?> | ||
|
@@ -44,8 +44,30 @@ | |
<?php endif; ?> | ||
</div><!-- .site-branding --> | ||
|
||
<nav id="site-navigation" class="main-navigation"> | ||
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Primary Menu', '_s' ); ?></button> | ||
<nav | ||
id="site-navigation" | ||
class="main-navigation" | ||
<?php if ( _s_is_amp() ) : ?> | ||
[class]=" siteNavigationMenuExpanded ? 'main-navigation toggled' : 'main-navigation' " | ||
<?php endif; ?> | ||
> | ||
<?php if ( _s_is_amp() ) : ?> | ||
<amp-state id="siteNavigationMenuExpanded"> | ||
<script type="application/json">false</script> | ||
</amp-state> | ||
<?php endif; ?> | ||
|
||
<button | ||
class="menu-toggle" | ||
aria-controls="primary-menu" | ||
aria-expanded="false" | ||
<?php if ( _s_is_amp() ) : ?> | ||
on="tap:AMP.setState( { siteNavigationMenuExpanded: ! siteNavigationMenuExpanded } )" | ||
[aria-expanded]="siteNavigationMenuExpanded ? 'true' : 'false'" | ||
<?php endif; ?> | ||
> | ||
<?php esc_html_e( 'Primary Menu', '_s' ); ?> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could not figure out what the button is for. Is it for the mobile menu? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. If you resize the window to the mobile breakpoint then this button appears. |
||
</button> | ||
<?php | ||
wp_nav_menu( array( | ||
'theme_location' => 'menu-1', | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,4 +129,5 @@ | |
</properties> | ||
</rule> | ||
|
||
<exclude-pattern>rtl.css</exclude-pattern> | ||
</ruleset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.