Subscribers for more details. Author: Subscribers.com Version: 1.2 screenshot.png subscribers.php Author URI: https://subscribers.com This relies on the actions being present in the themes header.php and footer.php * header.php code before the closing tag * wp_head(); * */ //------------------------------------------------------------------------// //---Config---------------------------------------------------------------// //------------------------------------------------------------------------// require_once("config.php"); $subscribers_embed_script = << HTML; //------------------------------------------------------------------------// //---Hook-----------------------------------------------------------------// //------------------------------------------------------------------------// add_action( 'wp_footer', 'subscribers_headercode', 1 ); add_action( 'admin_menu', 'subscribers_plugin_menu' ); add_action( 'admin_init', 'subscribers_register_mysettings' ); add_action( 'admin_notices', 'subscribers_warn_nosettings' ); //------------------------------------------------------------------------// //---Functions------------------------------------------------------------// //------------------------------------------------------------------------// // options page link function subscribers_plugin_menu() { add_options_page('Subscribers', 'Subscribers', 'create_users', 'subscribers_options', 'subscribers_plugin_options'); } // whitelist settings function subscribers_register_mysettings(){ register_setting('subscribers_options','subscribers_hash'); } //------------------------------------------------------------------------// //---Add "Settings" link to plugin Page-----------------------------------// //------------------------------------------------------------------------// function subscribers_plugin_settings_link($links) { $settings_link = 'Settings'; array_unshift($links, $settings_link); return $links; } $plugin = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin", 'subscribers_plugin_settings_link' ); //------------------------------------------------------------------------// //---Redirect to Settings page after activation---------------------------// //------------------------------------------------------------------------// register_activation_hook(__FILE__, 'subscribers_plugin_activate'); add_action('admin_init', 'subscribers_plugin_redirect'); function subscribers_plugin_activate() { add_option('subscribers_plugin_do_activation_redirect', true); } function subscribers_plugin_redirect() { if (get_option('subscribers_plugin_do_activation_redirect', false)) { delete_option('subscribers_plugin_do_activation_redirect'); // Do not redirect if activated as part of a bulk activate if(!isset($_GET['activate-multi'])) { wp_redirect("options-general.php?page=subscribers_options"); // wp_redirect() does not exit automatically and should almost always be followed by exit. exit; } } } //------------------------------------------------------------------------// //---Serving service worker-----------------------------------------------// //------------------------------------------------------------------------// add_action( 'parse_request', 'subscribers_service_worker' ); add_filter( 'query_vars', 'subscribers_query_vars' ); function subscribers_query_vars($vars) { $vars[] = 'firebase-messaging-sw'; return $vars; } // Served at `/?firebase-messaging-sw`. Needs to be at the top level in order // to be registered at the correct scope. function subscribers_service_worker($query) { if ( isset( $query->query_vars['firebase-messaging-sw'] ) ) { header( 'Content-Type: application/javascript' ); include( 'firebase-messaging-sw.js.php' ); exit; } } //------------------------------------------------------------------------// //---Output Functions-----------------------------------------------------// //------------------------------------------------------------------------// function subscribers_headercode(){ // runs in the header global $subscribers_embed_script; $subscribers_hash = get_option('subscribers_hash'); if($subscribers_hash){ echo str_replace('SUBSCRIBER_ID', $subscribers_hash, $subscribers_embed_script); // only output if options were saved } } //------------------------------------------------------------------------// //---Page Output Functions------------------------------------------------// //------------------------------------------------------------------------// // options page function subscribers_plugin_options() { ?>

Subscribers - Free Web Push Notifications

The Subscribers plugin will insert the necessary code into your Wordpress site just before the closing </body> tag. This will allow the subscribe popup and chicklet to be placed on your page so your visitors can subscribe.

In order to use this plugin, you need to have a Subscribers account. Please sign up here if you do not already have one.

Once you sign in to your Subscribers account please click on the link in the header that says “Install the code on your site” and scroll down to where your Site ID is displayed. Copy that ID and paste it into the field below and click Save changes.

After you save your Site ID above, go to the homepage of your website, right click somewhere on the page and click on "View page source." A new tab will open with the code for your site.

Next press CTRL+F (or Command+F on macOS) on your keyboard and type in "Subscriber" and if you see something like this, then you know the code has been added properly. This can take a few minutes to show up. If you have a caching plugin installed, you might need to clear your cache.

Example code

What are web push notifications?

PC with notifications

Web push notifications are the digital marketing world’s newest best friend. They allow you to send instant notifications, similar to those found on your smartphone to your subscribers’ devices.

This is an ideal solution for marketers looking for a new and very effective channel to reach your audience about news, sales, order status, special offers, empty shopping cart links, new content, events or anything else you can think of.

Conversion rates, opt-in rates, and click-through rates are all returning much higher results than traditional email marketing. Don’t wait and get started today, it’s super easy to get it installed and running on your site.

To enable it for your Wordpress site, sign up for free here. And don’t hesitate to reach out directly to us at support@subscribers.com

Subscribers is almost ready. You must enter your Site ID for it to work.

'; } }