Fancy Comments WordPress Shortcode

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

Before starting, here is an overview of the Fancy Comments WordPress Plugin and the shortcodes it provides:

Plugin Icon
Fancy Comments WordPress

"Fancy Comments WordPress is a user-friendly plugin that enhances your website's interaction by integrating stylish Facebook comments. It drives engagement, boosts social proof, and fosters community."

★★★★✩ (30) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [Fancy_Facebook_Comments]

Fancy Comments WordPress [Fancy_Facebook_Comments] Shortcode

The Fancy Facebook Comments shortcode is a tool that allows users to add a comments section to their WordPress site, with settings adjustable via shortcode attributes. This shortcode generates a comments box with customizable style, title, URL, heading tag, theme, number of comments, order, language, SDK loading, and width. It also includes an option to opt-in for comments moderation and notifier.

Shortcode: [Fancy_Facebook_Comments]


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

  • style – Defines the CSS style of the Facebook comment section.
  • title – Sets a title for the Facebook comments section.
  • url – Specifies the URL where comments will be placed.
  • heading_tag – Defines the HTML tag for the section title.
  • theme – Sets the color scheme of the comments section, either ‘light’ or ‘dark’.
  • num_comments – Determines the number of comments to display.
  • order_by – Sets the order of comments, ‘social’ ranks comments based on social signals.
  • language – Sets the language of the comments section, default is ‘en_GB’.
  • dont_load_sdk – If set, the Facebook SDK won’t load.
  • width – Defines the width of the comments section, default is 100%.

Examples and Usage

Basic example – Display Facebook comments on your website using the Fancy Facebook Comments plugin shortcode.

[Fancy_Facebook_Comments /]

Advanced examples

Display Facebook comments with a custom title, a dark theme, and a specified number of comments. The comments are ordered by social relevance.

[Fancy_Facebook_Comments title="User Comments" theme="dark" num_comments="5" order_by="social" /]

Embed Facebook comments in a specific URL, with a light theme, and a width of 500px. The comments are ordered in reverse chronological order and the SDK is not loaded.

[Fancy_Facebook_Comments url="" theme="light" width="500" order_by="reverse_time" dont_load_sdk="true" /]

Customize the display of Facebook comments with a specific style, heading tag, and language. The comments are ordered by time and the SDK is not loaded.

[Fancy_Facebook_Comments style="custom-style" heading_tag="h2" language="fr_FR" order_by="time" dont_load_sdk="true" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'Fancy_Facebook_Comments', array( $plugin_shortcodes, 'facebook_comments_shortcode' ) );

Shortcode PHP function:

function facebook_comments_shortcode( $params ) {

		extract( shortcode_atts( array(
			'style' => '',
			'title' => '',
			'url' => '',
			'heading_tag' => 'div',
			'theme' => 'light',
			'num_comments' => '',
			'order_by' => 'social',
			'language' => 'en_GB',
			'dont_load_sdk' => '',
			'width' => '',
		), $params ) );

		$html = '<div style="' . esc_attr( $style ) . '" class="heateor_ffc_facebook_comments">';
		if( $title != '' ) {
			$html .= '<' . esc_html( $heading_tag ) . ' class="heateor_ffc_facebook_comments_title">' . esc_html( $title ) . '</' . esc_html( $heading_tag ) . '>';
		$html .= '<style type="text/css">.fb-comments,.fb-comments span,.fb-comments span iframe[style]{min-width:100%!important;width:100%!important}</style>';
		if ( ! $dont_load_sdk ) {
			$html .= '<script type="text/javascript">!function(e,n,t){var o,c=e.getElementsByTagName(n)[0];e.getElementById(t)||(o=e.createElement(n),,o.src="//' . esc_js( $language ) . '/sdk.js#xfbml=1&version=v18.0",c.parentNode.insertBefore(o,c))}(document,"script","facebook-jssdk");</script>';
		$html .= $this->public_class_object->facebook_comments_moderation_optin();
		$html .= $this->public_class_object->facebook_comments_notifier_optin();
		$target_url = html_entity_decode( esc_url( $this->public_class_object->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ) );
		$target_url = $this->public_class_object->generate_facebook_comments_url( $target_url );
		$html .= '<div class="fb-comments" data-href="' . ( $url == '' ? $target_url : esc_url_raw( $url ) ) . '"';
	    $html .= ' data-numposts="' . intval( $num_comments ) . '"';
	    $html .= ' data-colorscheme="' . esc_attr( $theme ) . '"';
	    $html .= ' data-order-by="' . esc_attr( $order_by ) . '"';
	    $html .= ' data-width="' . ( $width == '' ? '100%' : esc_attr( $width ) ) . '"';
	    $html .= ' ></div></div>';
	    $html .= $this->public_class_object->facebook_comments_moderation_optin_script();
	    $html .= $this->public_class_object->facebook_comments_notifier_optin_script();
		return $html;

Code file location:



Now that you’ve learned how to embed the Fancy Comments WordPress 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

Your email address will not be published. Required fields are marked *