-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add offline browsing option in Reading settings #365
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #365 +/- ##
=============================================
- Coverage 25.54% 24.40% -1.14%
- Complexity 362 364 +2
=============================================
Files 54 55 +1
Lines 1785 1856 +71
=============================================
- Hits 456 453 -3
- Misses 1329 1403 +74
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
||
?> | ||
<script type="text/javascript"> | ||
jQuery( function( $ ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the jQuery dependency necessary or could this be written in vanilla JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could yes, but the wp-pointer JS API is itself based on jQuery, so that's why I'm using it here.
Co-authored-by: Derek Herman <derek.herman@xwp.co>
2f30d84
to
42215cd
Compare
This comment has been minimized.
This comment has been minimized.
42215cd
to
2f30d84
Compare
…/offline-browsing-option * 'develop' of github.com:GoogleChromeLabs/pwa-wp: Indicate function to be used in place of deprecated one Fix subpackage phpdoc tags Add offline template for twentytwentyone Exclude deprecated functions from code coverage Make all classes final since not intended to be extended Deprecate wp_service_worker_json_encode() in favor of wp_json_encode()
@googlebot I consent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
target.pointer( options ).pointer( 'open' ); | ||
} ); | ||
</script> | ||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A shame we can't use this code from WP core and have to copy it here. But okay 🙃
Fixes #344.
This adds a new Offline browsing toggle to the Reading Settings screen:
It is disabled by default. When disabled, by default only the offline page and server error page templates will be served to the user (or any other custom rules that the user may have registered such as via the obsolete Basic Site Caching plugin). When enabled, then the new default caching strategies are employed which were introduced in #338.
When someone updates to this version of a plugin, an admin pointer is displayed displayed to let them know about this feature: