Below, you’ll find a detailed guide on how to add the Gallery Images Ape 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 Gallery Images Ape Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Gallery Images Ape Plugin and the shortcodes it provides:
"Gallery Images Ape is a versatile WordPress plugin that allows users to create stunning and responsive image galleries, enhancing the visual appeal of your website."
- [ape-gallery]
Gallery Images Ape [ape-gallery] Shortcode
The Ape Gallery shortcode is a powerful tool for displaying images in a gallery format. It checks the attributes of the gallery and if found incorrect, it returns an error message.
Shortcode: [ape-gallery]
Parameters
Here is a list of all possible ape-gallery shortcode parameters and attributes:
$attr
– array of attributes to customize the gallery display
Examples and Usage
Basic example – A simple usage of ApeGallery shortcode to display a gallery by its ID.
[ape-gallery id="1" /]
Advanced examples
Display a gallery by its ID and specify the number of columns to be used in the gallery layout. If the gallery with the given ID is not found, an error message will be displayed.
[ape-gallery id="2" columns="3" /]
Display a gallery by its ID and specify the size of gallery images. If the gallery with the given ID is not found, an error message will be displayed.
[ape-gallery id="3" size="medium" /]
Display a gallery by its ID, specify the size of gallery images, and the number of columns to be used in the gallery layout. If the gallery with the given ID is not found, an error message will be displayed.
[ape-gallery id="4" size="large" columns="4" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [ape-gallery]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'ape-gallery', array($this, 'doShortcode') );
Shortcode PHP function:
function doShortcode( $attr ){
if( $this->checkAttrOnIdZero($attr)==false ){
return __('ApeGallery ShortCode is incorrect', 'gallery-images-ape');
}
return apeGalleryHelper::renderGalleryAttr( $attr );
}
Code file location:
gallery-images-ape/gallery-images-ape/modules/frontend/apeGalleryShortcode.php
Gallery Images Ape Shortcode
The Gallery Images Ape shortcode is designed to render a gallery based on given image IDs. It checks if the attributes on the IDs are correct, and if not, it returns an error message. This shortcode function, ‘doShortcodeFromIds’, is a part of the Gallery Images Ape plugin, which helps in creating visually appealing image galleries in WordPress.
Shortcode:
Examples and Usage
Basic example – A straightforward usage of the ‘gallery’ shortcode, where we are simply passing a single gallery ID as a parameter. This will render the gallery with the given ID on the webpage.
Advanced examples
Using the ‘gallery’ shortcode to display multiple galleries by referencing their IDs. The shortcode will render all the galleries with the given IDs on the webpage. This is useful when you want to display multiple galleries in a single location on your website.
Using the ‘gallery’ shortcode with additional parameters. In this example, we are passing ‘theme’ and ‘columns’ as additional parameters. The ‘theme’ parameter will change the appearance of the gallery based on the given theme, and the ‘columns’ parameter will determine the number of columns in the gallery. This allows for greater customization of the gallery’s appearance.
PHP Function Code
In case you have difficulties debugging what causing issues with shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'gallery', array($this, 'doShortcodeFromIds') );
Shortcode PHP function:
function doShortcodeFromIds( $attr ){
if( $this->checkAttrOnIds($attr)== false ){
return __('ApeGallery ShortCode is incorrect', 'gallery-images-ape');
}
return apeGalleryHelper::renderGalleryAttr( $attr );
}
Code file location:
gallery-images-ape/gallery-images-ape/modules/frontend/apeGalleryShortcode.php
Conclusion
Now that you’ve learned how to embed the Gallery Images Ape 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.
Leave a Reply