Boxzilla Shortcode

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

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

Plugin Icon
Boxzilla

"Boxzilla is a highly versatile WordPress plugin that allows you to create customizable pop-up boxes for your website, enhancing user engagement and interaction."

★★★★☆ (120) Active Installs: 30000+ Tested with: 6.2.3 PHP Version: 5.3
Included Shortcodes:
  • [boxzilla_link]

Boxzilla [boxzilla_link] Shortcode

The Boxzilla Link shortcode is a versatile tool for managing pop-up boxes. It allows users to show, hide, toggle, or dismiss boxes based on their needs. This shortcode accepts ‘box’, ‘class’, and ‘action’ as arguments. The ‘box’ argument specifies the box’s ID, ‘class’ adds CSS classes, and ‘action’ determines the box’s behavior.

Shortcode: [boxzilla_link]

Parameters

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

  • box – The ID of the box you want to control
  • class – CSS class to style the link
  • action – Action to perform, options: show, toggle, hide, dismiss

Examples and Usage

Basic example – A simple usage of the Boxzilla plugin shortcode to display a box with a specific ID.

[boxzilla_link box=1 /]

Advanced examples

Using the shortcode to show a specific box by ID and applying a CSS class to it. This allows for additional styling and customization of the box’s appearance.

[boxzilla_link box=1 class="my-box" /]

Using the shortcode to toggle the visibility of a box. This can be particularly useful for creating interactive elements on your page, such as collapsible sections or pop-up boxes.

[boxzilla_link box=1 action="toggle" /]

Using the shortcode to dismiss a box. This can be useful for creating dismissible notices or alerts on your website.

[boxzilla_link box=1 action="dismiss" /]

Combining multiple parameters for more advanced usage. In this example, we’re showing a box with a specific ID, applying a CSS class to it, and setting it to be dismissible.

[boxzilla_link box=1 class="my-box" action="dismiss" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'boxzilla_link', 'boxzilla_get_link_html' );

Shortcode PHP function:

function boxzilla_get_link_html( $args = array(), $content = '' ) {
	$valid_actions = array(
		'show',
		'toggle',
		'hide',
		'dismiss',
	);
	$box_id        = empty( $args['box'] ) ? '' : absint( $args['box'] );
	$class_attr    = empty( $args['class'] ) ? '' : esc_attr( $args['class'] );
	$action        = empty( $args['action'] ) || ! in_array( $args['action'], $valid_actions, true ) ? 'show' : $args['action'];
	return sprintf( '<a href="javascript:Boxzilla.%s(%s)" class="%s">', $action, $box_id, $class_attr ) . $content . '</a>';
}

Code file location:

boxzilla/boxzilla/src/default-actions.php

Conclusion

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