HG Slider Shortcode

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

Before starting, here is an overview of the Responsive WordPress Slider – HG Slider Plugin and the shortcodes it provides:

✩✩✩✩✩ () Active Installs: + Tested with: PHP Version:
Included Shortcodes:

HG Slider [flexslider] Shortcode

The Flexslider-hg shortcode is a useful tool for displaying a rotator slider on your website. This shortcode uses the ‘slug’ attribute to specify which slider to display. If no ‘slug’ is provided, an error message is triggered. This shortcode returns the specified Flexslider rotator.

Shortcode: [flexslider]

Parameters

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

  • slug – Identifier for specific flexslider content to display

Examples and Usage

Basic example – Utilizing the flexslider shortcode to display an image slider associated with the slug “homepage”.

[flexslider slug="homepage" /]

Advanced examples

Here, we are using the flexslider shortcode to display an image slider associated with the slug “product-gallery”. This is particularly useful when you want to display a specific set of images, such as a product gallery on an e-commerce website.

[flexslider slug="product-gallery" /]

Another advanced example is using the shortcode without any slug parameter. In this case, the shortcode will return a message asking for a slug parameter. This is helpful in debugging and ensuring that you have provided all necessary parameters for the shortcode to function properly.

[flexslider /]

PHP Function Code

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

Shortcode line:

add_shortcode('flexslider', 'flexslider_hg_shortcode');

Shortcode PHP function:

function flexslider_hg_shortcode($atts, $content = null)
{
	$slug = isset($atts['slug']) ? $atts['slug'] : "attachments";
	if(!$slug) { return apply_filters( 'flexslider_hg_empty_shortcode', "<p>" . __('Flexslider: Please include a slug parameter.', 'flexslider-hg') . " [flexslider slug=\"homepage\"]</p>" ); }
	return show_flexslider_rotator( $slug );
}

Code file location:

flexslider-hg/flexslider-hg/flexslider-hg.php

Conclusion

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