FooGallery Shortcodes

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

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

Plugin Icon
Best WordPress Gallery Plugin – FooGallery

"Best WordPress Gallery Plugin – FooGallery is a user-friendly tool to create stunning image galleries. It's simple to use, yet powerful, enhancing your WordPress site's visual appeal."

★★★★☆ (857) Active Installs: 100000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [foogallery_album_shortcode_tag]
  • [foogallery_gallery_shortcode_tag]
  • [foogallery-enqueue]

FooGallery [foogallery_album_shortcode_tag] Shortcode

The FooGallery Album shortcode is used to render a specific album on your webpage. It employs a template engine to generate the album layout. This shortcode takes in two parameters: ‘id’ and ‘album’. ‘Id’ is the album’s unique identifier, while ‘album’ is the album’s name. It then applies any filters to these arguments. The output is a string, which is the HTML required to display the album. This string is then returned, ready to be inserted into your webpage.

Shortcode: [foogallery_album_shortcode_tag]

Parameters

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

  • id – The unique identifier for the specific album
  • album – The name of the album to be displayed

Examples and Usage

Basic example – A simple usage of the FooGallery album shortcode to display an album by its ID.

[foogallery-album id=1 /]

Advanced examples

Using the shortcode to display a FooGallery album by its title. If an album with the given title exists, it will be displayed. If not, nothing will be shown.

[foogallery-album album='My First Album' /]

Combining both the ID and album parameters in the shortcode. The plugin will first try to load an album by the given ID. If an album with the specified ID does not exist, it will then try to load an album by the given title.

[foogallery-album id=1 album='My First Album' /]

These examples demonstrate the flexibility of the FooGallery album shortcode. By manipulating the id and album parameters, you can control which album is displayed in a very granular way.

PHP Function Code

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

Shortcode line:

add_shortcode( foogallery_album_shortcode_tag(), array( $this, 'render_foogallery_album_shortcode' ) );

Shortcode PHP function:

function render_foogallery_album_shortcode( $atts ) {

			$args = wp_parse_args( $atts, array(
				'id'    => 0,
				'album' => '',
			) );

			$args = apply_filters( 'foogallery-album_shortcode_atts', $args );

			//create new instance of template engine
			$engine = new FooGallery_Album_Template_Loader();

			ob_start();

			$engine->render_template( $args );

			$output_string = ob_get_contents();
			ob_end_clean();
			return $output_string;
		}

Code file location:

foogallery/foogallery/extensions/albums/public/class-shortcodes.php

FooGallery [foogallery-enqueue] Shortcode

The FooGallery shortcode is a powerful tool that enables the inclusion of gallery templates in your WordPress site. The ‘foogallery-enqueue’ shortcode is responsible for rendering and enqueueing the core gallery template scripts and styles. It also enqueues the ‘masonry’ script, providing a dynamic grid layout for your gallery.

Shortcode: [foogallery-enqueue]

Examples and Usage

Basic example – The following shortcode will render the foogallery enqueue, which will load the necessary scripts and styles for displaying a gallery.

[foogallery-enqueue /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'foogallery-enqueue', array( $this, 'render_foogallery_enqueue' ) );

Shortcode PHP function:

function render_foogallery_enqueue() {
			foogallery_enqueue_core_gallery_template_script();
			foogallery_enqueue_core_gallery_template_style();
			wp_enqueue_script( 'masonry' );
		}

Code file location:

foogallery/foogallery/includes/public/class-shortcodes.php

Conclusion

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