-
Notifications
You must be signed in to change notification settings - Fork 385
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
Wizard Step: Theme compatibility scanning #4795
Comments
From John: So we’ll need something that says “Here are the features of your site that will be missing in Reader mode.” Some of this could end up being opaque, e.g., if post types, taxonomies, or blocks are registered with nonexistent or untranslatable labels. We might have to keep the language vague (e.g., “Four registered post types will be missing in Reader mode.“). Also, blocks can be registered in JS only, so that part could be challenging. Although I guess JS-only blocks would end up being rendered and saved in the database, so would likely still work. The dynamic blocks rendered in PHP, which would be lost, can be checked in the scanner. From Weston: Correct. Only dynamic blocks would be a problem. Well, other than the CSS that a theme may enqueue for JS-only blocks. |
Is this an issue that needs copy to display what's happening to the user, or would this be a background task? |
The site compatibility scan involves checking URLs representative of the various templates and post types. So let's say that there are a dozen such URLs. There should be a progress bar that shows the status of checking each. The overall screen would say: “Checking Site Compatibility” with perhaps a description:
The site compatibility scan step of the wizard should have a progress bar that shows which template is currently being checked. |
This comment has been minimized.
This comment has been minimized.
Here's the logic that WP-CLI uses to prevent a theme from being loaded when |
Note: In #5192 (comment) I hid the template mode warnings on mobile. This should be revisited when theme scanning is implemented, figuring out a way to make warnings show on small viewports. cc @jwold @johnwatkins0 |
@johnwatkins0 One key aspect of this issue that is distinct from #4719 is the need to scan the theme for this bit:
There needs to be a REST API endpoint that lists out these entities (post types, shortcodes, blocks, etc), along with a parameter for whether the active theme should be short-circuited. When that same request is made without the active theme short-circuited, then if there is a difference in the registered entities, then we know that the theme is responsible for registering something and we need to warn that those entities will not be available when using a Reader theme. Users will need to move the entity registration logic into a custom plugin, which is a best practice anyway. |
Thanks for calling that out @westonruter. Yes, I think that's the main sizable new piece of the site scan work, and I'll make that the focus of this issue. |
There would be 4 conditions which would prevent a non-legacy Reader theme from being available to select:
In all Also, in the 3rd case we should try to detect the plugin that is causing the fatal error so that we can then mention to the user in the notice which plugin specifically is causing the fatal error. With that information in hand, we can advise that they have the option to suppress that plugin, which may allow them to then select the desired Reader theme. We have the Communicating the error back to the Settings screen and/or Onboarding Wizard will be a bit tricky. We'll have to actually load the site with a Reader theme active (e.g. with some query var that forces a Reader theme to be loaded prior to updating the settings) and then pass back the error details. For the latter part, perhaps the error screen added in #5320 could be modified to return a JSON object when |
This comment has been minimized.
This comment has been minimized.
Notes from a recent team call: At the end of the site scanning, we should have a message: "Please verify that everything is correct." Site Scanning could then report findings in a user friendly way, and essentially do the Site Review for the user (deprecating #6071 when complete), and have a message, "Some parts of your site may or may not be available, please verify." So for 2.2 we'll launch the |
@westonruter Do you think we can close it via #6610 just like the Plugin compatibility scanning issue (#4719)? |
@delawski Almost. I think the outstanding piece here is to incorporate #6516. Namely, we need to determine if the theme is registering any custom post types, taxonomies, shortcodes, blocks, etc. This is captured in this point above:
If so, we cannot rightly recommend recommend a Reader theme since doing so would cause the user to lose their custom functionality on AMP pages. |
Feature description
Alongside plugin compatibility scanning (#4719), scanning is also needed for the active theme. In particular, if the theme is not generating validation errors, then Standard or Transitional modes may be good choices. If the theme is generating validation errors, however, then Reader mode may be the best bet especially if the user does not have technical ability to fix the issues or evaluate whether the invalid markup can be removed.
There's one big caveat here for recommending Reader mode, and specifically a Reader theme. In particular, it may not be advisable if the active theme is violating a best practice of registering post types, taxonomies, post types, blocks, and widgets in plugins rather than in theme. If the active theme is registering a post type, for example, and a Reader theme is selected, then this post type will be absent entirely.
What we need to do is get a list of all registered blocks, widgets, post types, and taxonomies when the active theme is running. Then we need need to do it again with the active theme switched to an empty one. If there is a difference, then the missing entities were registered in the theme and will not be available in the new Reader mode. In such a mode, only Classic theme would be recommended. And we will need to list out what will not be available if a Reader theme is selected.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
The user is guided to choose the best template mode based on their active theme/plugins.
Implementation brief
\AmpProject\AmpWP\Validation\ScannableURLProvider::get_urls()
). Important: The list of URLs to validate should be returned and then each URL should be scanned. This must be done instead of scanning all URLs with loopback requests in one request to avoid timeouts.QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: