Below, you’ll find a detailed guide on how to add the Poptin Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Poptin Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Poptin Plugin and the shortcodes it provides:
"Poptin is a robust WordPress plugin that allows you to create engaging pop-ups, exit intent popups, email pop-ups, lightbox pop-ups, spin the wheel games, and contact forms to enhance user engagement."
- [poptin-form]
Poptin [poptin-form] Shortcode
The Poptin-form shortcode is a tool for embedding a Poptin form on your WordPress page. By inputting a specific ID, the shortcode pulls the associated form from Poptin’s database. .
Shortcode: [poptin-form]
Parameters
Here is a list of all possible poptin-form shortcode parameters and attributes:
poptin_div_id
– Defines the unique ID for the specific poptin form
Examples and Usage
Basic example – A simple usage of the Poptin form shortcode to display a form by its unique ID.
[poptin-form id="123"]
Advanced examples
Displaying a Poptin form by referencing its unique ID, and adding custom CSS classes for further customization.
[poptin-form id="123" class="custom-class another-custom-class"]
Using the shortcode to display a Poptin form by referencing its unique ID, and adding inline CSS styles for specific styling.
[poptin-form id="123" style="width: 100%; height: auto;"]
Note: In the above examples, replace “123” with the actual ID of your Poptin form. The custom classes and inline styles are optional and can be adjusted to your specific needs.
PHP Function Code
In case you have difficulties debugging what causing issues with [poptin-form]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('poptin-form', 'poptin_shortcode_form');
Shortcode PHP function:
function poptin_shortcode_form($arguments)
{
if(isset($arguments[0]) && !empty($arguments[0])) {
$poptin_div_id = $arguments[0];
return "<div class='poptin-embedded' data-id='" . esc_attr($poptin_div_id) . "'></div>";
}
}
Code file location:
poptin/poptin/poptin.php
Conclusion
Now that you’ve learned how to embed the Poptin Plugin shortcode, 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.
Leave a Reply