Email Subscribers Shortcodes

Below, you’ll find a detailed guide on how to add the Email Subscribers Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Email Subscribers Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Email Subscribers Plugin and the shortcodes it provides:

Plugin Icon
Icegram Express – Email Marketing, Newsletters and Automation for WordPress & WooCommerce

"Icegram Express is a versatile WordPress & WooCommerce plugin designed for superior email marketing. It effortlessly handles newsletters, automation, and subscriber management to boost your marketing strategies."

★★★★☆ (1071) Active Installs: 100000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [email-subscribers]
  • [email-subscribers-advanced-form]
  • [email-subscribers-form]

Email Subscribers [email-subscribers] Shortcode

The Email Subscribers shortcode is a tool that renders an email subscription form on your WordPress site. It uses the ‘render_es_subscription_shortcode’ function to display the form. This function allows customization of the form fields such as ‘namefield’, ‘desc’, and ‘group’. The ‘namefield’ attribute controls the visibility of the name field, ‘desc’ sets the description, and ‘group’ assigns the subscriber to a specific list.

Shortcode: [email-subscribers]

Parameters

Here is a list of all possible email-subscribers shortcode parameters and attributes:

  • namefield – Determines visibility of the name field in the subscription form.
  • desc – Sets a custom description for the subscription form.
  • group – Assigns the subscription form to a specific user group.

Examples and Usage

Basic example – A minimalist approach to using the ’email-subscribers’ shortcode. This example only includes the shortcode itself without any additional parameters.

[email-subscribers /]

Advanced examples

1. Using the ’email-subscribers’ shortcode with the ‘namefield’ parameter. This will display an email subscription form with a field for the subscriber’s name.

[email-subscribers namefield="yes" /]

2. Using the ’email-subscribers’ shortcode with the ‘desc’ parameter. This will display an email subscription form with a provided description.

[email-subscribers desc="Subscribe to our newsletter for latest updates." /]

3. Using the ’email-subscribers’ shortcode with the ‘group’ parameter. This will display an email subscription form associated with a specific group.

[email-subscribers group="Newsletter Subscribers" /]

4. Using the ’email-subscribers’ shortcode with multiple parameters. This will display an email subscription form with a name field, a specific description, and associated with a specific group.

[email-subscribers namefield="yes" desc="Subscribe to our newsletter for latest updates." group="Newsletter Subscribers" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [email-subscribers] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'email-subscribers', array( 'ES_Shortcode', 'render_es_subscription_shortcode' ) );

Shortcode PHP function:

function render_es_subscription_shortcode( $atts ) {
		ob_start();

		$atts = shortcode_atts( array(
			'namefield' => '',
			'desc'      => '',
			'group'     => ''
		), $atts, 'email-subscribers' );

		$data['name_visible'] = $atts['namefield'];
		$data['list_visible'] = 'no';
		$data['lists']        = array();
		$data['form_id']      = 0;
		$data['list']         = $atts['group'];
		$data['desc']         = $atts['desc'];

		self::render_form( $data );

		return ob_get_clean();
	}

Code file location:

email-subscribers/email-subscribers/lite/includes/class-email-subscribers.php

Email Subscribers [email-subscribers-advanced-form] Shortcode

The Email Subscribers Advanced Form shortcode is a tool that renders an email subscription form on a webpage. It takes an ‘id’ attribute, which corresponds to a specific form stored in the database. If the ‘id’ exists, it retrieves the form data and displays the corresponding form. This allows for dynamic form presentation, enhancing user interaction.

Shortcode: [email-subscribers-advanced-form]

Parameters

Here is a list of all possible email-subscribers-advanced-form shortcode parameters and attributes:

  • id – Unique identifier used to call a specific contact form

Examples and Usage

Basic example – The shortcode below is used to display an advanced form using the form’s ID. The ‘id’ parameter is used to specify the ID of the form to be displayed.

[email-subscribers-advanced-form id=1 /]

Advanced examples

Using the shortcode to display multiple advanced forms by referencing their IDs. The IDs are separated by commas. The forms will be displayed in the order of the IDs in the shortcode.

[email-subscribers-advanced-form id=1,2,3 /]

Using the shortcode to display an advanced form by referencing the ID. If the form with the specified ID is not found, the shortcode will not return anything.

[email-subscribers-advanced-form id=999 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [email-subscribers-advanced-form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'email-subscribers-advanced-form', array( 'ES_Shortcode', 'render_es_advanced_form' ) );

Shortcode PHP function:

function render_es_advanced_form( $atts ) {
		ob_start();

		$atts = shortcode_atts( array(
			'id' => ''
		), $atts, 'email-subscribers-advanced-form' );

		$af_id = $atts['id'];

		if ( ! empty( $af_id ) ) {
			$form = ES()->forms_db->get_form_by_af_id( $af_id );
			if ( $form ) {
				$form_data = ES_Forms_Table::get_form_data_from_body( $form );

				self::render_form( $form_data );
			}
		}

		return ob_get_clean();
	}

Code file location:

email-subscribers/email-subscribers/lite/includes/class-email-subscribers.php

Email Subscribers [email-subscribers-form] Shortcode

The Email Subscribers plugin shortcode is designed to render an email subscription form. It accepts parameters like ‘id’ and ‘show-in-popup’. The ‘id’ parameter identifies the specific form to display, while ‘show-in-popup’ determines if the form appears in a popup. The shortcode fetches the form data, renders the form, and returns the HTML.

Shortcode: [email-subscribers-form]

Parameters

Here is a list of all possible email-subscribers-form shortcode parameters and attributes:

  • id – Unique identifier for the specific email form.
  • show-in-popup – Controls if the form appears in a popup window.

Examples and Usage

Basic example – A simple usage of the shortcode to display an email subscribers form. The form is referenced by its ID.

[email-subscribers-form id="1" /]

Advanced examples

Displaying an email subscribers form in a pop-up. The form is referenced by its ID, and the ‘show-in-popup’ attribute is set to ‘yes’ to display the form in a pop-up.

[email-subscribers-form id="1" show-in-popup="yes" /]

Displaying an email subscribers form without specifying an ID. In this case, the ‘show-in-popup’ attribute is set to ‘no’ to display the form directly on the page.

[email-subscribers-form show-in-popup="no" /]

Displaying an email subscribers form by specifying an ID but not specifying the ‘show-in-popup’ attribute. The form is referenced by its ID, and by default, the form will be displayed directly on the page.

[email-subscribers-form id="1" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [email-subscribers-form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'email-subscribers-form', array( 'ES_Shortcode', 'render_es_form' ) );

Shortcode PHP function:

function render_es_form( $atts ) {
		ob_start();
		
		$atts = shortcode_atts( array( 
			'id' => '',
			'show-in-popup' => ''
		), $atts, 'email-subscribers-form' );

		$id = $atts['id'];

		if ( ! empty( $id ) ) {
			$form = ES()->forms_db->get_form_by_id( $id );

			if ( $form ) {

				$form_data = ES_Forms_Table::get_form_data_from_body( $form );
				$form_data['show-in-popup-attr'] = isset( $atts['show-in-popup'] ) ? sanitize_text_field( $atts['show-in-popup'] ) : '';
				$form_html = self::render_form( $form_data );
			}
		}

		return ob_get_clean();
	}

Code file location:

email-subscribers/email-subscribers/lite/includes/class-email-subscribers.php

Conclusion

Now that you’ve learned how to embed the Email Subscribers Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *