BlossomThemes Social Feed Shortcode

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

Before starting, here is an overview of the BlossomThemes Social Feed Plugin and the shortcodes it provides:

Plugin Icon
BlossomThemes Social Feed

"BlossomThemes Social Feed is a powerful WordPress plugin that seamlessly integrates your Instagram feed into your website, enhancing user engagement and social media presence."

★★★☆✩ (10) Active Installs: 40000+ Tested with: 6.2.3 PHP Version: 5.6
Included Shortcodes:
  • [blossomthemes_instagram_feed]

BlossomThemes Social Feed [blossomthemes_instagram_feed] Shortcode

The BlossomThemes Instagram Feed shortcode displays Instagram posts on your WordPress site. It fetches posts from the specified username, presenting them in a user-friendly layout. The shortcode uses an API to retrieve the posts and checks for errors. If misconfigured, it displays an error message to the admin. If no posts are available, it informs the user.

Shortcode: [blossomthemes_instagram_feed]

Examples and Usage

Basic example – A simple usage of the blossomthemes_instagram_feed shortcode to display Instagram feed on your website.

[blossomthemes_instagram_feed]

Advanced examples

Displaying a specific number of Instagram photos using the ‘photos’ parameter. In this example, we will display 5 photos.

[blossomthemes_instagram_feed photos=5]

Displaying Instagram photos from a specific username using the ‘username’ parameter. Replace ‘your_username’ with your actual Instagram username.

[blossomthemes_instagram_feed username="your_username"]

Combining both the ‘photos’ and ‘username’ parameters. This will display 5 photos from the specified Instagram username.

[blossomthemes_instagram_feed username="your_username" photos=5]

Please note that these examples assume that the ‘blossomthemes_instagram_feed’ shortcode is properly configured and the Instagram API is correctly set up. If not, you may encounter errors or the photos may not display as expected.

PHP Function Code

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

Shortcode line:

add_shortcode( 'blossomthemes_instagram_feed', array( $this, 'display' ) );

Shortcode PHP function:

function display(){

		if( is_admin() ) return;

		ob_start();

        $settings = BlossomThemes_Instagram_Feed_Settings::get_settings();
		$instaUrl = 'https://www.instagram.com/';
		$instaUrl .= $settings['username'];

		$this->api = Blossomthemes_Instagram_Feed_API::get_instance();

		$items = $this->api->get_items( $settings['photos'] );

		if ( ! is_array( $items ) ) {
			if ( current_user_can( 'edit_theme_options' ) ) {
				echo '<p>'.__( 'BlossomThemes Social Feed misconfigured, check plugin &amp; widget settings.',
                'blossomthemes-instagram-feed' ).'</p>';
            } else {
				echo '<b style="color:red;">'.__('No posts available!','blossomthemes-instagram-feed').'</b>';
			}
		} else {
			require plugin_dir_path( BTIF_FILE_PATH ) . 'public/partials/blossomthemes-instagram-feed-public-display.php';
		}

		$output = '<div class="btif-instagram-feed">' . ob_get_contents() . '</div>';
		ob_end_clean();
		return apply_filters( 'btif_instagram_shortcode_filter', $output );
	}

Code file location:

blossomthemes-instagram-feed/blossomthemes-instagram-feed/includes/class-blossomthemes-instagram-feed-shortcodes.php

Conclusion

Now that you’ve learned how to embed the BlossomThemes Social Feed 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 *