-
Notifications
You must be signed in to change notification settings - Fork 382
Onboarding wizard: improve Reader mode and Transitional mode recommendations #4990
Description
From @westonruter in #4980 (comment).
We should export to JS this logic from PHP:
$has_amp_support = current_theme_supports( 'amp' ) || in_array( get_stylesheet(), AMP_Core_Theme_Sanitizer::get_supported_themes(), true );Note I'm intentionally using get_stylesheet() here as opposed to get_template() because child themes of core themes are often not AMP-compatible.
Nevertheless, we may want to hold off on doing this until I finish my work on the Reader theme loading because this changes how the amp theme support is mutated (or not).
There's also a case to do something similar for Reader mode, for themes that don't have amp theme support and yet have an amp directory, which is captured by this logic at the moment:
amp-wp/includes/class-amp-theme-support.php
Lines 349 to 366 in a8a4d4d
| * Gets whether the parent or child theme supports Reader Mode. | |
| * | |
| * True if the theme does not call add_theme_support( 'amp' ) at all, | |
| * and it has an amp/ directory for templates. | |
| * | |
| * @return bool Whether the theme supports Reader Mode. | |
| */ | |
| public static function supports_reader_mode() { | |
| return ( | |
| ! self::get_support_mode_added_via_theme() | |
| && | |
| ( | |
| is_dir( trailingslashit( get_template_directory() ) . self::READER_MODE_TEMPLATE_DIRECTORY ) | |
| || | |
| is_dir( trailingslashit( get_stylesheet_directory() ) . self::READER_MODE_TEMPLATE_DIRECTORY ) | |
| ) | |
| ); | |
| } |
We may want to mention that the active theme has special legacy Reader mode support, and also indicate that in the list of Reader themes.