Below, you’ll find a detailed guide on how to add the Alligator Popup 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 Alligator Popup Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Alligator Popup Plugin and the shortcodes it provides:
"Alligator Popup is a user-friendly WordPress plugin that helps you create and manage attention-grabbing popups. Enhance user engagement and increase conversion rates with this interactive tool."
- [popup]
Alligator Popup [popup] Shortcode
The Alligator Popup shortcode allows you to create a popup window in WordPress. It uses the ‘popup’ shortcode to generate a clickable link that opens a new window. The shortcode takes parameters for URL, width, height, scrollbars, and alt text. The ‘scrollbars’ parameter determines whether the popup window will have scrollbars, with ‘yes’ as the default value. The ‘alt’ parameter is for the alt text of the link. The function ‘cc_popup_shortcode’ processes these parameters and returns an HTML anchor tag with the necessary data attributes for the popup functionality.
Shortcode: [popup]
Parameters
Here is a list of all possible popup shortcode parameters and attributes:
url
– Defines the URL that the popup will direct to.width
– Sets the width of the popup window in pixels.height
– Determines the height of the popup window in pixels.scrollbars
– Controls the appearance of scrollbars in the popup window.alt
– Provides an alternative text for the popup link.
Examples and Usage
Basic example – A simple popup with default width, height, and scrollbars enabled.
[popup url="https://example.com"]Click me![/popup]
Advanced examples
Creating a popup with custom dimensions and scrollbars disabled.
[popup url="https://example.com" width="600" height="600" scrollbars="no"]Larger Popup[/popup]
Adding an alternative text to the popup link for better accessibility.
[popup url="https://example.com" alt="Example Alt Text"]Click me![/popup]
Combining all parameters to create a fully customized popup.
[popup url="https://example.com" width="600" height="600" scrollbars="no" alt="Example Alt Text"]Fully Customized Popup[/popup]
PHP Function Code
In case you have difficulties debugging what causing issues with [popup]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'popup', 'cc_popup_shortcode' );
Shortcode PHP function:
function cc_popup_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'url' => '#',
'width' => '400',
'height' => '400',
'scrollbars' => 'yes',
'alt' => ''
), $atts ) );
$showscrollbars = esc_attr( $scrollbars );
if (strtolower( $showscrollbars ) == 'no') {
$showscrollbars = '0';
}
if ($showscrollbars != '0') {
$showscrollbars = '1';
}
return '<a href="' . esc_url( $url ) . '" class="popup" data-width="' . absint( $width ) . '" data-height="' . absint( $height ) . '" data-scrollbars="' . $showscrollbars . '" alt="' . esc_attr( $alt ) . '">' . $content . '</a>';
}
Code file location:
alligator-popup/alligator-popup/alligator-popup.php
Conclusion
Now that you’ve learned how to embed the Alligator Popup 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