Gallery Slideshow Shortcode

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

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

Plugin Icon
Gallery Slideshow

"Gallery Slideshow is a dynamic WordPress plugin that lets you create visually stunning slideshows from your photo galleries. It's user-friendly and enhances visual storytelling on your site."

★★★★✩ (16) Active Installs: 2000+ Tested with: 4.8.23 PHP Version: false
Included Shortcodes:
  • [gss]

Gallery Slideshow [gss] Shortcode

The Gallery Slideshow shortcode is a tool that allows you to add a customizable slideshow to your WordPress site. The ‘gss’ shortcode enqueues necessary scripts and styles, checks for a custom JavaScript file, and extracts attributes from the shortcode. It includes options for image IDs, size, link, name, style, and carousel settings. If the ‘gss_html_output’ function doesn’t exist, it requires ‘gss_html.php’. The shortcode then generates a slideshow based on these settings and returns the output.

Shortcode: [gss]

Parameters

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

  • ids – Identifiers of images to be included in the slideshow.
  • size – Defines the size of the images in the slideshow.
  • link – Specifies the URL to which the images in the slideshow will link.
  • name – Sets the unique name for the slideshow.
  • style – Determines the overall look and feel of the slideshow.
  • options – Offers additional customization features for the slideshow.
  • carousel – Enables carousel layout for the slideshow if set.

Examples and Usage

Basic Example – A simple usage of the gallery-slideshow plugin shortcode. This example will display a gallery slideshow with default parameters.

[gss ids="1,2,3" /]

Advanced Examples – Displaying gallery slideshows with custom parameters. These examples will show how to use the shortcode with different attributes to customize the slideshow.

Using the shortcode to display a gallery slideshow with custom size and link. This example will display a gallery slideshow with images of ‘medium’ size and each image will link to its attachment page.

[gss ids="1,2,3" size="medium" link="attachment" /]

Using the shortcode to display a gallery slideshow with custom style and options. This example will display a gallery slideshow with a ‘fade’ style and ‘auto’ option which means the slideshow will play automatically.

[gss ids="1,2,3" style="fade" options="auto" /]

Using the shortcode to display a gallery slideshow with a carousel. This example will display a gallery slideshow with a carousel of thumbnails below the main slideshow.

[gss ids="1,2,3" carousel="true" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'gss', array(__CLASS__, 'gss_shortcode') );

Shortcode PHP function:

function gss_shortcode($atts) { 
		wp_enqueue_script( 'cycle2' );
		// wp_enqueue_script( 'cycle2_center' );
		wp_enqueue_script( 'cycle2_carousel' );
		wp_enqueue_script( 'gss_js' );
		wp_enqueue_style( 'gss_css' );
		$custom_js = plugin_dir_path( __FILE__ ) . 'gss-custom.js';
		if ( file_exists($custom_js) ) {
			wp_register_script( 'gss-custom-js', plugins_url( 'gss-custom.js' , __FILE__ ) );
			wp_enqueue_script( 'gss-custom-js' );
		}
		extract( shortcode_atts( array( 'ids' => '', 'size' => 'full', 'link' => '', 'name' => 'gslideshow', 'style' => '', 'options' => '', 'carousel' => '' ), $atts ) );
        if ( !function_exists('gss_html_output') ) {
			require 'gss_html.php';
		}
		$output = gss_html_output($ids,$size,$link,$name,$style,$options,$carousel);
        return $output;
    }

Code file location:

gallery-slideshow/gallery-slideshow/gallery-slideshow.php

Conclusion

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