How to Add Your Own Email Subscription Service to The Plugin?

Article sections

    Easy Social Share Buttons for WordPress support some of the most popular subscribe services but there are many more available. If yours is not inside the list you can easy add it and make it work using the build inside plugin API. Here is an example code how this is made for Jetpack subscriptions

     * Plugin Name: Easy Social Share Buttons for WordPress Subscribe Connector - JetPack Subscriptions
     * Description: Activate usage of JetPack Subscriptions in Opt-in Module
     * Plugin URI:
     * Version: 1.0
     * Author: CreoApps
     * Author URI:
     * Register your service inside plugin menu to allow selection
    add_filter('essb_external_subscribe_connectors', 'essb_subscribe_register_jetpack');
    function essb_subscribe_register_jetpack($connectors) {
    	$connectors['jetpack'] = __('JetPack Subscriptions', 'essb');
    	return $connectors;
     * Execute filter on subscribe button press
    add_filter('essb_subscribe_jetpack', 'essb_subscribe_jetpack', 10, 3);
    function essb_subscribe_jetpack($email, $name, $output) {
    	// access custom options with essb_option_value or essb_option_bool_value for switch elements. Example $value = essb_option_value('jetpack_text');
    	if (class_exists('Jetpack_Subscriptions')) {
    		$subscribe = Jetpack_Subscriptions::subscribe($email, 0, false);
    		$output['code'] = '1';
    		$output['message'] = __('Thank your for your subscribing', 'essb');		
    	else {
    		$output['exteranl_connection_message'] = __('JetPack Subscriptions is not activated', 'essb');
    	return $output;
     * Register Custom Connector Additional Options
    add_filter('essb_external_subscribe_connectors_options', 'essb_subscribe_register_custom_options');
    function essb_subscribe_register_custom_options($options) {
    	$options['jetpack'] = array(
    		'jetpack_text' => array('type' => 'text', 'title' => 'Text Element', 'desc' => 'My Description'),
    		'jetpack_switch' => array('type' => 'switch', 'title' => 'Switch Test', 'desc' => 'Switch Description Test'),
    		'jetpack_select' => array('type' => 'select', 'title' => 'Select Element', 'desc' => 'Description', 'values' => array('test1' =>'Test Value 1', 'test2' => 'Test Value 2'))		
    	return $options;

    The code can be made as a separate plugin which you can install like all others or add it inside theme functions.php file.

    Have more questions? We’re more than happy to assist.
    in Developers
    Was this article helpful?
    Have more questions? We’re more than happy to assist.