Scroll Triggered Box Shortcode

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

Before starting, here is an overview of the Scroll Triggered Box Plugin and the shortcodes it provides:

Plugin Icon
Scroll Triggered Box

"Scroll Triggered Box is a powerful WordPress plugin that dynamically displays boxes of content, triggered by user-scrolling. It's perfect for capturing leads, showcasing promotions, or emphasizing key content."

★★★★✩ (60) Active Installs: 2000+ Tested with: 6.1.4 PHP Version: false
Included Shortcodes:
  • [close-button]

Scroll Triggered Box [close-button] Shortcode

The Dreamgrow Scroll Triggered Box shortcode is a functional tool that enables the addition of a customizable close button to the scroll-triggered box. The shortcode ‘close-button’ utilizes PHP to create a close button with a default text ‘Close’. However, it allows customization by accepting an array parameter ‘text’. This parameter can be set to change the button text, offering adaptability to match your site’s context and language.

Shortcode: [close-button]

Parameters

Here is a list of all possible close-button shortcode parameters and attributes:

  • text – Customizes the text displayed on the close button

Examples and Usage

Basic example – A simple usage of the shortcode to display a close button with default text ‘Close’.

[close-button /]

Advanced examples

Customizing the text of the close button by passing the ‘text’ attribute to the shortcode.

[close-button text='Dismiss' /]

Using the shortcode to display multiple close buttons with different texts. You can use this shortcode multiple times in the same post or page, and each instance can have its own custom text.

[close-button text='Dismiss'] [close-button text='Hide'] [close-button text='Close']

PHP Function Code

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

Shortcode line:

add_shortcode('close-button', array($this, 'close_button') );

Shortcode PHP function:

function close_button($atts) {
        $text='Close';
        if(is_array($atts) and isset($atts['text'])) {
            $text=$atts['text'];
        }
        return '<a class="dgd_stb_box_close_button">'.$text.'</a>';
    }

Code file location:

dreamgrow-scroll-triggered-box/dreamgrow-scroll-triggered-box/dgd-scrollbox.php

Conclusion

Now that you’ve learned how to embed the Scroll Triggered Box 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.

Comments

Leave a Reply

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