Skip to content

Onboarding wizard: improve Reader mode and Transitional mode recommendations #4990

@johnwatkins0

Description

@johnwatkins0

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:

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

Metadata

Metadata

Assignees

Labels

ChangeloggedWhether the issue/PR has been added to release notes.EnhancementNew feature or improvement of an existing oneGroomedWS:UXWork stream for UX/Front-end

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions