This plugin adds progressive web app features to your WordPress site.
Create a web app manifest using the WordPress backend. No coding skills required!
Provide an awesome app-like experience while making your website installable. It uses the data defined in manifest.json.
No connection? No problem!
This feature allows you to provide offline usage for your website.
A copy of each page is stored in the browser cache as the visitor views it. This allows a visitor to load any previously viewed page while they are offline. The plugin also defines a special “offline page”, which allows you to customize a message and the experience if the app is offline and the page is not in the cache.
Send push notifications from the WP Admin interface!
This plugin uses Firebase Cloud Messaging as a messaging service: https://firebase.google.com/
Please register your application there. You will need the Server Key
and the Sender ID
.
Progressive WordPress comes with an integrated notification button where the user can register an unregister for push notification. You can either use the built in fixed button from the admin panel or you could have a look at the Developers section.
After those steps you will have an overview about all registered devices, you can manage them and you can send push notifications to all of them or selected devices. Awesome, right!?
Progressive WordPress offers a lot of possibilities for developers the extend it the way they need it.
Add content to the serviceworker:
function myplugin_sw_content( $content ) {
return $content; //needs to be valid serviceworker JavaScript
}
add_filter( 'pwp_sw_content', 'myplugin_sw_content' );
Regenerate serviceworker:
The Serviceworker (pwp-serviceworker.js
) will be regenerated as soon as new settings are saved (but only if the settings actually changed).
You can regenerate it by using pwp_serviceworker_regenerate();
.
Add content to the manifest:
function myplugin_manifest_values( $values ) {
$values['new'] = 'New';
return $values; //needs to be valid an array (will be json_endoded)
}
add_filter( 'pwp_manifest_values', 'myplugin_manifest_values' );
Regenerate manifest:
The Manifest (pwp-manifest.json
) will be regenerated as soon some plugin settings are saved.
You can regenerate it by using pwp_manifest_regenerate();
.
customoize Button
If you don't want to use the built in Button, you can create your own from a shortcode or a php function:
// Shortcode
[pwp_notification_button size="1rem" class="your-class"]
// Function
$atts = [
'class' => 'notification-button--fixedfooter',
'style' => "background-color: #ff0000; color: #00ff00; font-size: 35px",
];
pwp_get_notification_button( $atts ); // returns the html template.
Filter: pwp_notification_button_attributes
This filter adds custom attributes to the notification button:
function myplugin_notification_button_atttibutes( $attributes ) {
$attributes['data-test'] = 'My value';
return $attributes;
}
add_filter( 'pwp_notification_button_attributes', 'myplugin_notification_button_atttibutes' );
The key will be used as attribute key (will be sanitized sanitize_title()
), the value will be used as attribute value (sanitized with esc_attr()
).
Create your own button
You are also free to create your own button. The states are indicated as body classes:
body.pwp-notification
if push notifications are supportedbody.pwp-notification.pwp-notification--on
if the device is registeredbody.pwp-notification.pwp-notification--loader
if there is something loading
You can then use the JS functions pwpRegisterPushDevice();
and pwpDeregisterPushDevice();
.
- added default settings on activate
- Bugfix: Minifying JS threw an Uncaught SyntaxError
- added default settings on activate
- added UTM tracking for manifest starturl and push notification redirect url
- required php Version is now 5.6
- critical Bugfix: JavaScript error
- Bugfix: better way to check if files have to be regenerated
- Bugfix: PushPost not always registered
- Improvement: new manifest icon sizes
- Bugfix: CSS z-index for notification button
- Bugfix: Pushpost labels
- fixed spelling mistakes
- Stable version 1.0.0
- added multisite support
- Pushpost: send push notifications right from the post edit screen
- Added translation: de_DE
- Added translation: de_CH
- push button color input-type improvements
- add JS vars as
wp_add_inline_script
- extended developer functionalities
- added a latest push log
- added a debug log
- using
WP_Filesystem
API instead of phpfile_put_contents
- Added "orientation" to manifest
- Added colorpicker to settings
- Fix: is_ssl() improvement
- Bugfix: featured image could not be changed if push notifications are enabled
- Bugfix: prohibit console error if sw not supported
- Added offline content
- select front page as offline Page
- Improvement: better hex check for manifest colors
- Bugfix: notification Button always visible
- Added push notifications!
- let the user manage their subscription
- manage all registered deivces
- send push notifications to all or specific devices
- added ad status checks
- force the browser to unregister all other serviceworkers
- minor bugfixes and improvements
- you can now change the manifest start_url
- Bugfixes
- changed offline indicator
- added better instructions
- codepattern improvements
- added offline indicator
- Grammatical changes by Mark Howells-Mead
- "installable" is now optional
- Manifest Icon has to be png and min. 144x144px.
- Initial version from 2018
- Nico Martin | nicomartin.ch | @nic_o_martin
Use this code freely, widely and for free. Provision of this code provides and implies no guarantee.
Please respect the GPL v3 licence, which is available via http://www.gnu.org/licenses/gpl-3.0.html