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

Allow themes to provide alternate templates in “paired mode” #849

ThierryA opened this Issue Jan 9, 2018 · 0 comments


3 participants
Copy link

ThierryA commented Jan 9, 2018

Acceptance Criteria

AC1: Using “paired mode,” themes can specify an alternative path to use for AMP templates (see @westonruter’s comment proposed).
AC2: When themes do this, the templates in that directory will replace the entire “paired mode” template system in the plugin. The AMP toggle developed in 0.6 will continue to be available in this mode.


  • Add theme support property to indicate path to paired-mode templates, for the theme root, where the template hierarchy will be evaluated. This may be called theme_root or template_directory or template_path or something else that makes the most sense.
  • And add callback function which is used to determine whether a given request should be routed to the paired mode. Have default logic that tries to identify the template for a given request and if it is is present, then make AMP available. Otherwise, don’t make it available. For example, if requesting a single page, but there is no page.php or index.php in the AMP template root, then AMP would not be available by default.
  • Update amp_prepare_render() to prevent calling add_action( 'template_redirect', 'amp_render' ); when current_theme_supports( 'amp' ), as we need to not use amp_render() since it uses the old paired-mode theme system; instead, this function should do whatever is required (e.g. add template_include filter), per the next task (implement template hierarchy).
  • Implement the same template hierarchy resolution logic, ideally re-use what is in core. Figure out how to make use of the custom theme root for AMP templates.
  • Continue outputting the AMP rel link in head for non-AMP templates and other things that happen in current paired mode. And also include relevant links in head for AMP templates. Toggle what is output in wp_head based on whether it is an AMP response or not.

@ThierryA ThierryA added this to the v0.7 milestone Jan 9, 2018

@MackenzieHartung MackenzieHartung added this to To Do in v0.7 Jan 9, 2018

@MackenzieHartung MackenzieHartung moved this from To Do to Definition in v0.7 Jan 9, 2018

@MackenzieHartung MackenzieHartung moved this from Definition to To Do in v0.7 Jan 9, 2018

@westonruter westonruter referenced this issue Jan 12, 2018


Add initial canonical AMP support #857

0 of 1 task complete

@kaitnyl kaitnyl moved this from To Do to In Progress in v0.7 Jan 15, 2018

@kaitnyl kaitnyl moved this from In Progress to Ready for Review in v0.7 Jan 15, 2018

@kaitnyl kaitnyl moved this from Ready for Review to QA in v0.7 Jan 15, 2018

@ThierryA ThierryA moved this from QA to Ready for Merging in v0.7 Jan 18, 2018

@ThierryA ThierryA added the Sprint 2 label Mar 8, 2018

@ThierryA ThierryA moved this from Ready for Merging to Beta Release in v0.7 Mar 8, 2018

@kevincoleman kevincoleman moved this from Beta Release to Production Release in v0.7 May 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment