WP Easy Gallery – WordPress Gallery Shortcode

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

Before starting, here is an overview of the WP Easy Gallery – WordPress Gallery Plugin and the shortcodes it provides:

Plugin Icon
WP Easy Gallery – WordPress Gallery Plugin

"WP Easy Gallery is a WordPress Gallery Plugin. It provides a quick and easy way to create beautiful, responsive galleries for your WordPress site. This is an ideal tool to showcase your images in style."

★★★✩✩ (20) Active Installs: 2000+ Tested with: 6.0.6 PHP Version: 5.6
Included Shortcodes:
  • [EasyGallery]

WP Easy Gallery – WordPress Gallery [EasyGallery] Shortcode

The ‘EasyGallery’ shortcode is a part of the wp-easy-gallery plugin. It enables users to generate a gallery by calling the ‘createEasyGallery’ function. The shortcode takes two parameters: ‘id’ and ‘key’, both default to ‘-1’. This function returns a gallery based on the provided ‘id’ and ‘key’.

Shortcode: [EasyGallery]

Parameters

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

  • id – A unique identifier for the gallery
  • key – A specific key to access the gallery

Examples and Usage

Basic example – The following shortcode displays the EasyGallery by referencing the gallery ID.

[EasyGallery id=1 /]

Advanced examples

1. Displaying the EasyGallery by referencing both ID and key. The gallery will first try to load by ID, but if not found, it will try to load by key.

[EasyGallery id=1 key='gallery1' /]

2. If you don’t know the ID of your gallery, you can use the key attribute alone. The gallery will load by key.

[EasyGallery key='gallery1' /]

These examples illustrate how flexible and versatile the EasyGallery shortcode can be. By understanding and utilizing the available attributes, you can display your galleries in a way that best suits your needs.

PHP Function Code

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

Shortcode line:

add_shortcode('EasyGallery', array($this, 'EasyGallery_Handler'));

Shortcode PHP function:

function EasyGallery_Handler($atts) {
			$atts = shortcode_atts( array( 'id' => '-1', 'key' => '-1'), $atts );
			return $this->createEasyGallery($atts['id'], $atts['key']);
		}

Code file location:

wp-easy-gallery/wp-easy-gallery/wp-easy-gallery.php

Conclusion

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