Datafeedr Comparison Sets Shortcode

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

Before starting, here is an overview of the Datafeedr Comparison Sets Plugin and the shortcodes it provides:

Plugin Icon
Datafeedr Comparison Sets

"Datafeedr Comparison Sets is a powerful WordPress plugin that enables you to create and display product comparison sets, enhancing your e-commerce capabilities."

★★★★★ (10) Active Installs: 3000+ Tested with: 6.2.3 PHP Version: 7.4
Included Shortcodes:
  • [dfrcs]

Datafeedr Comparison Sets [dfrcs] Shortcode

The Datafeedr Comparison Sets (DFRCS) shortcode enables the display of product comparison sets on your WordPress site. Shortcode Name: DFRCS It pulls the post ID and type, applies default settings, and passes these to the ‘dfrcs_compset’ function. This function generates the comparison set based on the provided source.

Shortcode: [dfrcs]


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

  • context – Defines the context where the shortcode is used.
  • post_id – Represents the unique identifier of the post.

Examples and Usage

Basic example – The following shortcode displays the comparison set for a specific post by using its post ID.

[dfrcs post_id=123 /]

Advanced examples

Here, the shortcode is used to display the comparison set for a specific post with a particular context. The context helps to define the specific comparison set to be displayed.

[dfrcs context='shortcode_post' post_id=123 /]

In this example, the shortcode is used to display a comparison set for a custom post type. The context is defined as ‘shortcode_’ followed by the custom post type.

[dfrcs context='shortcode_customposttype' post_id=123 /]

Finally, this shortcode example shows how to display a comparison set without specifying the post ID. In this case, the comparison set of the current post will be displayed.

[dfrcs context='shortcode_post' /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'dfrcs', 'dfrcs_shortcode' );

Shortcode PHP function:

                    function dfrcs_shortcode( $atts ) {

	$post_type = ( $type = get_post_type() ) ? '_' . $type : '';

	$defaults = array(
		'context' => 'shortcode' . $post_type,
		'post_id' => get_the_ID(),

	$source = wp_parse_args( $atts, $defaults );

	return dfrcs_compset( $source );

Code file location:



Now that you’ve learned how to embed the Datafeedr Comparison Sets 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 *