Social Feed Shortcode

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

Before starting, here is an overview of the Social Feed | All social media in one place Plugin and the shortcodes it provides:

Plugin Icon
Social Feed | All social media in one place

"Social Feed is a WordPress plugin that consolidates all your social media in one place. This tool integrates your Facebook feed, along with other platforms, providing a comprehensive social media view."

★★★✩✩ (13) Active Installs: 3000+ Tested with: 5.8.8 PHP Version: false
Included Shortcodes:
  • [SMUZSF]

Social Feed | All social media in one place [SMUZSF] Shortcode

The SMUZSF shortcode of the Add-Facebook plugin is designed to process and display content based on a specified ID. It extracts the ID from the shortcode attributes and checks if the post associated with the ID is published. The shortcode then determines the theme layout for the content and sets the template path accordingly. It applies filters to the template path and sets up the template variables. The content is then buffered, included from the template path, and returned for display.

Shortcode: [SMUZSF]

Parameters

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

  • id – The unique identifier of the Facebook post or page.

Examples and Usage

Basic example – A simple usage of the shortcode would be to display a social media feed by referencing its ID. This will load the feed that has been set up with the given ID.

[SMUZSF_SHORTCODE id=1 /]

Advanced examples

Using the shortcode to display a social media feed by referencing its ID and changing the layout. This will load the feed that has been set up with the given ID and apply the selected layout to it.

[SMUZSF_SHORTCODE id=1 wssf_select_layout='layout2' /]

Using the shortcode to display a social media feed by referencing its ID and applying a custom template. This will load the feed that has been set up with the given ID and apply the custom template to it.

[SMUZSF_SHORTCODE id=1 smuzsf_template_path='my_custom_template' /]

PHP Function Code

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

Shortcode line:

add_shortcode( SMUZSF_SHORTCODE, array( $this, 'process_shortcode' ) );

Shortcode PHP function:

                    function process_shortcode( $atts ) {

		extract( shortcode_atts( array(
				'id' => null
			), $atts ) );

		if ( ! $id )
			return FALSE;

		if ( get_post_status( $id ) !== 'publish' )
			return FALSE;

		$theme = smuzsf_get_option( $id, 'wssf_select_layout' );

		
		$template_path = smuzsf_view_public_path( 'templates/default/template.php' );

		if ( $theme !== 'layout' ) {

			$template_path = 'templates/'.$theme.'/template.php';

			$template_path = smuzsf_view_public_path( $template_path );

		}

        $template_path = apply_filters( 'smuzsf_template_path', $template_path, $id  );

        $template_var = $this->setup_template_variables( $id );

		ob_start();
		
		include ( $template_path ); 

		$content = ob_get_contents();
		ob_end_clean();

		return $content;

	}
                    

Code file location:

add-facebook/add-facebook/public/classes/class-smuzsf-public.php

Conclusion

Now that you’ve learned how to embed the Social Feed | All social media in one place 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 *