Divi Torque Lite Shortcode

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

Before starting, here is an overview of the Divi Torque Lite Plugin and the shortcodes it provides:

Plugin Icon
Divi Torque Lite

"Divi Torque Lite is a dynamic WordPress plugin designed to supercharge your Divi website. This addon offers enhanced features and tools for a more responsive and streamlined site design."

★★★★☆ (104) Active Installs: 30000+ Tested with: 6.2.3 PHP Version: 7.0
Included Shortcodes:
  • [divi_library_shortcode]

Divi Torque Lite [divi_library_shortcode] Shortcode

The ‘addons-for-divi’ plugin shortcode ‘divi_library_shortcode’ is used to call and display a Divi Library item within a post or page. The ‘id’ attribute specifies the unique ID of the Divi Library item. The shortcode checks if the Divi Builder is in use, and then returns the corresponding Divi Library item.

Shortcode: [divi_library_shortcode]

Parameters

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

  • id – Unique identifier of the Divi Library module.

Examples and Usage

Basic Example – A simple usage of the addon-for-divi plugin shortcode to display a specific divi library item by its ID.

[divi_library_shortcode id=123 /]

Advanced Examples

Exhibit a Divi library item using its ID, in addition to an optional GET parameter. This can be useful for debugging or for displaying different versions of the same module based on the presence of a GET parameter.


// Assuming you have a GET parameter set, like: yourwebsite.com/?et_fb=1
[divi_library_shortcode id=123 /]

Note: In the advanced example, the ‘et_fb’ GET parameter doesn’t need to be included in the shortcode itself. It’s checked within the shortcode’s PHP function. If the ‘et_fb’ parameter is present in the URL, the function will still return the specified Divi library item.

PHP Function Code

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

Shortcode line:

add_shortcode('divi_library_shortcode', array($this, 'shortcode_callback'));

Shortcode PHP function:

function shortcode_callback($atts)
		{

			$atts = shortcode_atts(
				array(
					'id' => '',
				),
				$atts,
				'divi_library_shortcode'
			);

			if (!empty($_GET['et_fb'])) { //phpcs:ignore

				$shortcode = do_shortcode(
					sprintf(
						'[et_pb_section global_module="%1$s"][/et_pb_section]',
						esc_attr($atts['id'])
					)
				);

				return $shortcode;
			} else {

				$shortcode = do_shortcode(
					sprintf(
						'[et_pb_section global_module="%1$s"][/et_pb_section]',
						esc_attr($atts['id'])
					)
				);

				return $shortcode;
			}
		}

Code file location:

addons-for-divi/addons-for-divi/includes/extensions/library-shortcodes/ext-library-shortcodes.php

Conclusion

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