WP Google Review Slider Shortcode

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

Before starting, here is an overview of the WP Google Review Slider Plugin and the shortcodes it provides:

Plugin Icon
WP Google Review Slider

"WP Google Review Slider is a user-friendly WordPress plugin that effortlessly pulls reviews from your Google Places page and displays them on your website in a slider format."

★★★★☆ (286) Active Installs: 30000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [wprevpro_usetemplate]

WP Google Review Slider [wprevpro_usetemplate] Shortcode

The WP Google Places Review Slider plugin shortcode is a powerful tool enabling the display of Google reviews on your website. The shortcode uses the ‘wprev_usetemplate_func’ function, which fetches reviews based on the template ID (‘tid’) provided. The output is then included in the webpage using the ‘wp-google-reviews-public-display.php’ file.

Shortcode: [wprevpro_usetemplate]

Parameters

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

  • tid – The unique identifier of the template
  • bar – An additional parameter for extra functionality

Examples and Usage

Basic example – It showcases a simple way to use the shortcode by referencing the template ID.

[wprevpro_usetemplate tid=1 /]

Advanced examples

Example 1: In this example, we are using the shortcode to display a review template by referencing both template ID and bar. The bar parameter can be used for adding additional customization to your template.

[wprevpro_usetemplate tid=1 bar="custom" /]

Example 2: Here, we are using the shortcode with multiple template IDs. This can be useful when you want to display reviews from multiple templates on the same page.

[wprevpro_usetemplate tid="1,2,3" bar="custom" /]

Remember, the ‘tid’ attribute is used to specify the template ID(s), and the ‘bar’ attribute is used for adding extra customization to your template. If the template ID is not found, the shortcode will not display anything.

PHP Function Code

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

Shortcode line:

add_shortcode( 'wprevpro_usetemplate', array($this,'wprev_usetemplate_func') );

Shortcode PHP function:

function wprev_usetemplate_func( $atts, $content = null ) {
		//get attributes
		    $a = shortcode_atts( array(
				'tid' => '0',
				'bar' => 'something',
			), $atts );		//$a['tid'] to get id
	
				ob_start();
				include plugin_dir_path( __FILE__ ) . '/partials/wp-google-reviews-public-display.php';
				return ob_get_clean();
	}

Code file location:

wp-google-places-review-slider/wp-google-places-review-slider/public/class-wp-google-reviews-public.php

Conclusion

Now that you’ve learned how to embed the WP Google Review Slider 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 *