Icegram Engage Shortcodes

Below, you’ll find a detailed guide on how to add the Icegram Engage 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 Icegram Engage Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Icegram Engage Plugin and the shortcodes it provides:

Plugin Icon
Icegram Engage – The Best WordPress Popup, Optin, CTA and Lead Generation Plugin

"Icegram Engage is a comprehensive WordPress plugin for effective lead generation. It features popup creation, opt-in forms, CTA buttons, and more, all designed to boost user engagement and conversion rates."

★★★★☆ (361) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [icegram]
  • [ig_form]

Icegram Engage [icegram] Shortcode

The Icegram shortcode is a powerful tool that dynamically displays messages or campaigns on your WordPress site. It prepares an array with conditions and adds a placeholder div, with the actual display happening in the footer. This shortcode allows for customization, accepting parameters for campaigns, messages, and ‘skip_others’. If campaigns are specified and content is present, it triggers on click. It also replaces commas with spaces in values for better HTML compatibility.

Shortcode: [icegram]

Parameters

Here is a list of all possible icegram shortcode parameters and attributes:

  • campaigns – Specifies the campaigns to display with the shortcode.
  • messages – Defines the specific messages to show within the campaigns.
  • skip_others – If set to ‘yes’, no other campaigns or messages will be shown.

Examples and Usage

Basic example – A simple use of the Icegram shortcode to display a specific campaign or message.

[icegram campaigns="1" /]

Here, the ‘campaigns’ attribute is used to specify the campaign ID. This will display the campaign with the ID 1 on the front-end of your WordPress site.

Advanced examples

Using the Icegram shortcode to display multiple campaigns or messages, while also skipping other campaigns.

[icegram campaigns="1,2,3" skip_others="yes" /]

In this example, the ‘campaigns’ attribute is used to specify multiple campaign IDs, separated by commas. The ‘skip_others’ attribute is set to ‘yes’, which means that other campaigns will not be displayed on the page where this shortcode is used.

Another advanced usage is to trigger a campaign or message on click, by adding content within the shortcode.

[icegram campaigns="1"]Click here to trigger campaign[/icegram]

This example will display a clickable text ‘Click here to trigger campaign’. Once clicked, it will trigger the display of the specified campaign.

PHP Function Code

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

Shortcode line:

add_shortcode( 'icegram', array( &$this, 'execute_shortcode' ) );

Shortcode PHP function:

function execute_shortcode( $atts = array(), $content = null ) {
			// When shortcode is called, it will only prepare an array with conditions
			// And add a placeholder div
			// Display will happen in footer via display_messages()
			$i                               = count( $this->shortcode_instances );
			$this->shortcode_instances[ $i ] = shortcode_atts( array(
				'campaigns'   => '',
				'messages'    => '',
				'skip_others' => 'no'
			), $atts );

			$class[] = "ig_shortcode_container";
			$html[]  = "<div id='icegram_shortcode_{$i}'";
			if ( ! empty( $atts['campaigns'] ) && ! empty( $content ) ) {
				$this->shortcode_instances[ $i ]['with_content'] = true;
				$class[]                                         = "trigger_onclick";
			}
			foreach ( $atts as $key => $value ) {
				$value  = str_replace( ",", " ", $value );
				$html[] = " data-{$key}=\"" . htmlentities( $value ) . "\" ";
			}
			$class  = implode( " ", $class );
			$html[] = "class='" . $class . "' >" . $content . "</div>";

			return implode( " ", $html );
		}

Code file location:

icegram/icegram/lite/class-icegram.php

Icegram Engage [ig_form] Shortcode

Icegram’s ‘ig_form’ shortcode is a powerful tool that allows you to embed a form within your WordPress site. By using this shortcode, you can create a div element with the class ‘ig_form_container layout_inline’ for inline form layout.

Shortcode: [ig_form]

Examples and Usage

Basic example – The shortcode [ig_form] is used to execute the ‘execute_form_shortcode’ function, which returns a div with the class ‘ig_form_container layout_inline’, representing an inline Icegram form.

[ig_form]

PHP Function Code

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

Shortcode line:

add_shortcode( 'ig_form', array( &$this, 'execute_form_shortcode' ) );

Shortcode PHP function:

function execute_form_shortcode( $atts = array() ) {
			return '<div class="ig_form_container layout_inline"></div>';
		}

Code file location:

icegram/icegram/lite/class-icegram.php

Conclusion

Now that you’ve learned how to embed the Icegram Engage 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 *