Ml Slider Shortcode

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

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

Plugin Icon
Slider, Gallery, and Carousel by MetaSlider – Responsive WordPress Slideshows

"Slider, Gallery, and Carousel by MetaSlider is a versatile WordPress plugin. It allows you to create stunning responsive slideshows, beautiful image galleries, and engaging carousels with ease."

★★★★☆ (682) Active Installs: 600000+ Tested with: 6.3.2 PHP Version: 7.0
Included Shortcodes:
  • [metaslider]

Ml Slider [metaslider] Shortcode

The MetaSlider shortcode is used to embed a slideshow in a WordPress page or post. It accepts parameters like ‘id’, ‘title’, ‘restrict_to’, and ‘theme’. If ‘id’ or ‘title’ is not provided, it exits. If ‘title’ is given, it fetches the corresponding ‘id’. It also allows restricting the slider to a specific page or the homepage. If the specified slider is not found or not published, it returns a comment.

Shortcode: [metaslider]

Parameters

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

  • id – The unique ID of the MetaSlider.
  • title – The title of the MetaSlider, used to fetch the ID.
  • restrict_to – Limits display of the MetaSlider to specific pages.
  • theme – The theme applied to the MetaSlider.

Examples and Usage

Basic example – Displaying a MetaSlider slideshow by referencing its ID.

[metaslider id=123 /]

Advanced examples:

Displaying a MetaSlider slideshow by referencing its title. The slideshow will load by title, and if not found, it will return false.

[metaslider title="My Slideshow" /]

Restricting a MetaSlider slideshow to a specific page by referencing the ID of the slideshow and the page. The slideshow will only display on the specified page.

[metaslider id=123 restrict_to="home" /]

Applying a specific theme to a MetaSlider slideshow by referencing the ID of the slideshow and the theme. The specified theme will be applied to the slideshow.

[metaslider id=123 theme="dark" /]

Combining multiple parameters to display a MetaSlider slideshow. The slideshow will load by title, apply a specific theme, and restrict its display to a specified page.

[metaslider title="My Slideshow" theme="dark" restrict_to="home" /]

PHP Function Code

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

Shortcode line:

add_shortcode('metaslider', array($this, 'register_shortcode'));

Shortcode PHP function:

Code file location:

ml-slider/ml-slider/ml-slider.php

Conclusion

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