Widgets for Airbnb Reviews Shortcode

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

Before starting, here is an overview of the Widgets for Airbnb Reviews Plugin and the shortcodes it provides:

Plugin Icon
Widgets for Airbnb Reviews

"Widgets for Airbnb Reviews is a handy WordPress plugin that allows you to easily display and manage user reviews from Airbnb on your website. Enhance your credibility with real testimonials!"

★★★★☆ (27) Active Installs: 2000+ Tested with: 6.3.2 PHP Version: 5.2
Included Shortcodes:
  • [add_shortcode]

Widgets for Airbnb Reviews [add_shortcode] Shortcode

The Review-Widgets-For-Airbnb shortcode facilitates the display of Airbnb reviews on your site. The function ‘shortcode_func’ validates the widget ID and ensures your business is connected. If not, it returns an error. It also supports no-registration widgets, defaulting to the first available platform if not specified. The shortcode provides error handling for deficient shortcode and empty widget ID.

Shortcode: [add_shortcode]

Parameters

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

  • data-widget-id – Unique identifier for the specific Trustindex widget.
  • no-registration – Specifies the platform to use if no widget ID is provided.

Examples and Usage

Basic example – Display a specific widget by referencing its unique ID.

[review-widget data-widget-id="478dcc2136263f2b3a3726ff" /]

Advanced examples

Using the shortcode to display a widget without registration by specifying the platform. The platform will be checked, and if it’s not a valid platform, the first available platform will be used.

[review-widget no-registration="trustpilot" /]

Using the shortcode to display a widget without registration, but forcing a specific platform. If the platform is not a valid one, an error message will be displayed.

[review-widget no-registration="invalidplatform" /]

Please note that the above examples are based on the shortcode function provided. The actual shortcodes may vary depending on the implementation and the parameters accepted by the shortcode.

PHP Function Code

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

Shortcode line:

add_shortcode($tag, [ $this, 'shortcode_func' ]);

Shortcode PHP function:

function shortcode_func($atts)
{
$atts = shortcode_atts([ 'data-widget-id' => null, 'no-registration' => null ], $atts);
if (isset($atts['data-widget-id']) && $atts['data-widget-id']) {
return $this->get_trustindex_widget($atts['data-widget-id']);
}
else if (isset($atts['no-registration']) && $atts['no-registration']) {
$forcePlatform = $atts['no-registration'];
if (substr($forcePlatform, 0, 5) !== 'trust' && substr($forcePlatform, -4) !== 'ilot' && !in_array($forcePlatform, $this->get_platforms())) {
$avPlatforms = $this->get_platforms();
$forcePlatform = $avPlatforms[0];
}
$filePath = __FILE__;
if (isset($this->plugin_slugs[ $forcePlatform ])) {
$filePath = preg_replace('/[^\/\\\\]+([\\\\\/]trustindex-plugin\.class\.php)/', $this->plugin_slugs[ $forcePlatform ] . '$1', $filePath);
}
$chosedPlatform = new self($forcePlatform, $filePath, "do-not-care-10.9.1", "do-not-care-Widgets for Airbnb Reviews", "do-not-care-Airbnb");
$chosedPlatform->setNotificationParam('not-using-no-widget', 'active', false);
if (!$chosedPlatform->is_noreg_linked()) {
return $this->error_box_for_admins(self::___('You have to connect your business (%s)!', [ $forcePlatform ]));
}
else {
return $chosedPlatform->get_noreg_list_reviews($forcePlatform);
}
}
else {
return $this->error_box_for_admins(self::___('Your shortcode is deficient: Trustindex Widget ID is empty! Example: ') . '<br /><code>['.$this->get_shortcode_name().' data-widget-id="478dcc2136263f2b3a3726ff"]</code>');
}
}

Code file location:

review-widgets-for-airbnb/review-widgets-for-airbnb/trustindex-plugin.class.php

Conclusion

Now that you’ve learned how to embed the Widgets for Airbnb Reviews 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 *