WP Customer Reviews Shortcodes

Below, you’ll find a detailed guide on how to add the WP Customer Reviews Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the WP Customer Reviews Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the WP Customer Reviews Plugin and the shortcodes it provides:

Plugin Icon
WP Customer Reviews

"WP Customer Reviews is a user-friendly WordPress plugin that enables businesses to easily collect, manage, and display customer reviews on their website."

★★★★✩ (514) Active Installs: 30000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [WPCR_INSERT]
  • [WPCR_SHOW]
  • [WPCR_HCARD]

WP Customer Reviews [WPCR_INSERT] Shortcode

The WP-Customer-Reviews shortcode ‘WPCR_INSERT’ allows the addition of customer reviews to any part of your website. It activates the ‘shortcode_insert’ function, which forces the active page to display the reviews.

Shortcode: [WPCR_INSERT]

Examples and Usage

Basic example – The shortcode ‘WPCR_INSERT’ is used to insert customer reviews. By default, it displays all reviews.

[WPCR_INSERT]

Advanced examples

Here we use the shortcode to display only 5 customer reviews. The ‘num’ parameter is used to limit the number of reviews displayed.

[WPCR_INSERT num=5]

In the next example, we use the ‘show_title’ parameter to control whether the title of the reviews is displayed or not. If ‘show_title’ is set to ‘false’, the titles will not be displayed.

[WPCR_INSERT show_title=false]

Finally, we can combine multiple parameters to customize the display of the reviews. In this example, we limit the display to 5 reviews, hide the titles, and sort the reviews by date in descending order.

[WPCR_INSERT num=5 show_title=false sort_by=date sort_dir=desc]

PHP Function Code

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

Shortcode line:

add_shortcode('WPCR_INSERT', array(&$this, 'shortcode_insert'));

Shortcode PHP function:

function shortcode_insert() {
        $this->force_active_page = 'shortcode_insert';
        return $this->do_the_content('', 'shortcode_insert');
    }

Code file location:

wp-customer-reviews/wp-customer-reviews/wp-customer-reviews-3.php

WP Customer Reviews [WPCR_SHOW] Shortcode

The WP-Customer-Reviews shortcode is a tool that displays customer reviews on your WordPress site. This shortcode has various attributes such as ‘postid’, ‘num’, ‘paginate’, ‘perpage’, ‘hidecustom’, ‘snippet’, ‘more’, ‘showform’, ‘hidereviews’, ‘hideresponse’. These attributes help customize the display of reviews. For example, ‘postid’ sets the post ID for the reviews to be displayed, ‘num’ sets the number of reviews to display, and ‘paginate’ enables pagination. If ‘postid’ is set to ‘all’, it queries all reviews. If ‘showform’ is set to 1, it displays the review form.

Shortcode: [WPCR_SHOW]

Parameters

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

  • postid – Identifier for the post to show reviews for, ‘all’ for all posts
  • num – Maximum number of reviews to display
  • paginate – If set to 1, paginate the reviews, else show all at once
  • perpage – Number of reviews to show per page, when pagination is enabled
  • hidecustom – If set to 1, custom fields in reviews are hidden
  • snippet – When set to 1, shows a short snippet of each review
  • more – Text for the ‘Read More’ link in review snippets
  • showform – If set to 1, displays the review submission form
  • hidereviews – If set to 1, it hides the reviews from view
  • hideresponse – If set to 1, it hides the responses to reviews

Examples and Usage

Basic example – Display all reviews without any custom fields and without the review form.

[WPCR_SHOW postid="all" hidecustom="1" showform="0"]

Advanced examples

Display reviews of a particular post with a limit of 10 reviews per page. The reviews are paginated and the review form is hidden.

[WPCR_SHOW postid="123" num="10" paginate="1" showform="0"]

Display reviews with custom fields for a particular post. The number of reviews displayed is 5 and the plugin will try to display the review form. If the post has no reviews, the form will not be displayed.

[WPCR_SHOW postid="123" num="5" hidecustom="0" showform="1"]

Show only the review form for a specific post, hiding all reviews and responses.

[WPCR_SHOW postid="123" hidereviews="1" hideresponse="1" showform="1"]

PHP Function Code

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

Shortcode line:

add_shortcode('WPCR_SHOW', array(&$this, 'shortcode_show'));

Shortcode PHP function:

function shortcode_show($atts) {
		$attArr = shortcode_atts(array(
			'postid' => 'all', 'num' => 5, 'paginate' => 1, 'perpage' => 5, 'hidecustom' => 0, 'snippet' => 0,
			'more' => '', 'showform' => 1, 'hidereviews' => 0, 'hideresponse' => 0
		), $atts);
		
		$opts = new stdClass();
        foreach ($attArr as $key => $val) {
			$opts->$key = $val;
		}
		
		$opts->postid = $this->strip_trim($opts->postid);
        
        if (strtolower($opts->postid) == 'all') { $opts->postid = -1; } // -1 queries all reviews
        $opts->morelink = $opts->more;
		
		$intArr = array('postid', 'num', 'paginate', 'perpage', 'hidecustom', 'snippet', 'showform', 'hidereviews', 'hideresponse');
		foreach ($intArr as $key) {
			$opts->$key = isset($opts->$key) ? $this->strip_trim_intval($opts->$key) : 0;
		}
        
		if ($opts->postid === -1) { $opts->showform = 0; } // do not show form if postid is "all"
		$opts->showsupport = 0;
		if ($opts->showform == 1) { $opts->showsupport = 1; }
		
		$opts->wrapper = 1;
		
        return $this->output_reviews_show($opts);
    }

Code file location:

wp-customer-reviews/wp-customer-reviews/wp-customer-reviews-3.php

WP Customer Reviews [WPCR_HCARD] Shortcode

The ‘WPCR_HCARD’ shortcode is a part of the WP Customer Reviews plugin. This shortcode is deprecated and returns blank when used. The related PHP code indicates that the shortcode doesn’t perform any action and returns an empty string when called.

Shortcode: [WPCR_HCARD]

Examples and Usage

Basic Example – A straightforward usage of the WPCR_HCARD shortcode. This shortcode is deprecated and returns blank, so it won’t display anything on the page.

[WPCR_HCARD /]

PHP Function Code

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

Shortcode line:

add_shortcode('WPCR_HCARD', array(&$this, 'shortcode_hcard')); // deprecated, returns blank

Shortcode PHP function:

function shortcode_hcard($atts) {
		return '';
	}

Code file location:

wp-customer-reviews/wp-customer-reviews/wp-customer-reviews-3.php

Conclusion

Now that you’ve learned how to embed the WP Customer Reviews Plugin shortcodes, 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 *