XO Slider Shortcodes

Below, you’ll find a detailed guide on how to add the XO Slider Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the XO Slider Plugin shortcodes not to show or not to work correctly.

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

Plugin Icon
XO Slider

"XO Slider is a versatile WordPress plugin that enables easy creation and management of responsive sliders. With its user-friendly interface, the xo-liteslider plugin is perfect for enhancing your website's visuals."

★★★★★ (3) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: 7.0
Included Shortcodes:
  • [xo_liteslider]
  • [xo_slider]

XO Slider [xo_liteslider] Shortcode

The ‘xo_liteslider’ shortcode is part of the xo-liteslider plugin. It fetches a specific slider based on its ID. The shortcode uses the ‘get_liteslider_shortcode’ function, which accepts attributes and returns the slider associated with the given ‘id’.

Shortcode: [xo_liteslider]

Parameters

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

  • id – Specifies the unique identifier of the liteslider

Examples and Usage

Basic example – A simple usage of the xo_liteslider shortcode to display a slider with a specific ID.

[xo_liteslider id=1 /]

Advanced examples

Using the shortcode to display a slider by referencing the ID. If the slider with the given ID is not found, it will not display anything.

[xo_liteslider id=2 /]

Another advanced usage of the shortcode where we’re trying to display a slider with an ID that may not exist. In this case, the shortcode will return an empty string, meaning no slider will be displayed.

[xo_liteslider id=999 /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'xo_liteslider', array( $this, 'get_liteslider_shortcode' ) );

Shortcode PHP function:

function get_liteslider_shortcode( $atts ) {
		$atts = shortcode_atts( array( 'id' => 0 ), $atts, 'xo_liteslider' );
		return $this->get_slider( $atts['id'] );
	}

Code file location:

xo-liteslider/xo-liteslider/inc/class-xo-slider.php

XO Slider [xo_slider] Shortcode

The xo-liteslider plugin shortcode, ‘xo_slider’, generates a specific slider on the page. It uses the function ‘get_slider_shortcode’ to fetch the slider with the provided ID. The ‘id’ attribute in the shortcode allows you to specify which slider to display. Shortcode: [xo_slider id=”1″] This will display the slider with an ID of 1. The ‘shortcode_atts’ function sets the default ID to 0 if no ID is provided.

Shortcode: [xo_slider]

Parameters

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

  • id – Specifies the unique identifier of the slider

Examples and Usage

Basic example – Utilizing the xo_slider shortcode to display a specific slider by referencing its ID.

[xo_slider id=3 /]

Advanced examples

Using the shortcode to display multiple sliders by referencing their IDs. This allows you to showcase various sliders on a single page, enhancing your website’s visual appeal and user experience.

[xo_slider id=3 /]
[xo_slider id=5 /]
[xo_slider id=7 /]

Another advanced usage of the shortcode could be to display a slider and fall back to a default slider if the specified ID is not found. This ensures that a slider is always displayed, improving the consistency of your website’s design.

[xo_slider id=3 /]
[xo_slider id=0 /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'xo_slider', array( $this, 'get_slider_shortcode' ) );

Shortcode PHP function:

function get_slider_shortcode( $atts ) {
		$atts = shortcode_atts( array( 'id' => 0 ), $atts, 'xo_slider' );
		return $this->get_slider( $atts['id'] );
	}

Code file location:

xo-liteslider/xo-liteslider/inc/class-xo-slider.php

Conclusion

Now that you’ve learned how to embed the XO Slider Plugin shortcodes, 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 *