Below, you’ll find a detailed guide on how to add the Social Feed 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 Social Feed Gallery Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Social Feed Gallery Plugin and the shortcodes it provides:
"Social Feed Gallery is a dynamic WordPress plugin that lets you seamlessly integrate and display your Instagram content, enhancing your site with a visually rich gallery."
- [insta-gallery]
Social Feed Gallery [insta-gallery] Shortcode
The ‘insta-gallery’ shortcode of PHP/WordPress is designed to fetch and display Instagram feeds. It uses the ‘Models_Feed’ class to retrieve the specific feed based on the provided ID.
Shortcode: [insta-gallery]
Parameters
Here is a list of all possible insta-gallery shortcode parameters and attributes:
id
– Identifies the specific Instagram gallery to display
Examples and Usage
Basic example – Showcases the simplest way to use the shortcode by only specifying the ‘id’ attribute.
[insta-gallery id=1 /]
Advanced examples
Illustrates the use of the shortcode with multiple ‘id’ attributes. This will display multiple Instagram galleries, each corresponding to the specified ‘id’.
[insta-gallery id=1 /]
[insta-gallery id=2 /]
[insta-gallery id=3 /]
Another advanced usage could be to use the shortcode within a PHP script. This is a bit more complex but allows for more flexibility. In the below example, the ‘id’ is dynamically generated based on a variable value.
<?php
$gallery_id = get_option('instagram_gallery_id');
echo do_shortcode('[insta-gallery id="'.$gallery_id.'"]');
?>
PHP Function Code
In case you have difficulties debugging what causing issues with [insta-gallery]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'insta-gallery', array( $this, 'do_shortcode' ) );
Shortcode PHP function:
function do_shortcode( $atts, $content = null ) {
$atts = shortcode_atts(
array(
'id' => 0,
),
$atts
);
$id = absint( $atts['id'] );
$models_feed = new Models_Feed();
$feed = $models_feed->get_by_id( $id );
return $this->create_shortcode( $feed, $id );
}
Code file location:
insta-gallery/insta-gallery/lib/frontend/class-load.php
Conclusion
Now that you’ve learned how to embed the Social Feed 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.
Leave a Reply