Below, you’ll find a detailed guide on how to add the Reviews Feed 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 Reviews Feed Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Reviews Feed Plugin and the shortcodes it provides:
"Reviews Feed – Google Reviews & Yelp Reviews Plugin is a versatile tool that integrates and displays Google and Yelp reviews directly on your WordPress site, enhancing credibility."
- [reviews-feed-cron-simulator]
- [reviews-feed]
Reviews Feed [reviews-feed-cron-simulator] Shortcode
The ‘reviews-feed-cron-simulator’ shortcode is designed for automatic updates. It ensures all reviews are current by checking the authorization status and initiating updates if necessary.
Shortcode: [reviews-feed-cron-simulator]
Examples and Usage
Basic example – The shortcode triggers the ‘init’ function within the ‘reviews-feed-cron-simulator’ plugin. It doesn’t require any parameters or attributes to function.
[reviews-feed-cron-simulator]
PHP Function Code
In case you have difficulties debugging what causing issues with [reviews-feed-cron-simulator]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('reviews-feed-cron-simulator', array( $this, 'init' ) );
Shortcode PHP function:
function init() {
$this->auth_check = new AuthorizationStatusCheck();
if ( $this->should_do_updates() ) {
$this->auth_check->update_status(
[ 'last_cron_update' => time() ]
);
$this->do_updates();
}
}
Code file location:
reviews-feed/reviews-feed/class/Common/Services/FeedCacheUpdateService.php
Reviews Feed [reviews-feed] Shortcode
The ‘reviews-feed’ shortcode from the Shortcode Name plugin is used to render reviews based on the specified feed ID. It also allows for displaying single manual reviews. This shortcode retrieves settings based on the feed ID and checks if a single manual review is set. If true, it merges the review content with the settings. It then initializes the feed, checks for errors, and displays the feed accordingly.
Shortcode: [reviews-feed]
Parameters
Here is a list of all possible reviews-feed shortcode parameters and attributes:
feed
– Identifier of the specific review feedname
– Parameter to display a single manual review
Examples and Usage
Basic example – Displaying a review feed by referencing the feed ID.
[reviews-feed feed=1 /]
Advanced examples
Displaying a single manual review by referencing the name attribute. The review will only load if there is a review with the specified name in the feed.
[reviews-feed feed=1 name="John Doe" /]
Displaying a review feed with a specific feed ID and a single manual review. If the manual review with the specified name is not found, the feed will still load with the specified feed ID.
[reviews-feed feed=2 name="Jane Doe" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [reviews-feed]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('reviews-feed', array( $this, 'render' ) );
Shortcode PHP function:
function render( $atts = array() ) {
$feed_id = ! empty( $atts['feed'] ) ? $atts['feed'] : 0;
$is_single_manual_review = isset( $atts['name'] ) && !empty( $atts['name'] ) ? true : false;
$settings = SBR_Settings::get_settings_by_feed_id( $feed_id, false, $is_single_manual_review );
if( $is_single_manual_review ){
$settings = array_merge(
$settings,
$this->get_single_manual_review_content( $atts )
);
}
do_action( 'sbr_before_shortcode_render', $settings );
$feed = new Feed( $settings, $feed_id, new FeedCache( $feed_id, 2 * DAY_IN_SECONDS ) );
$feed->init();
if ( ! empty( $feed->get_errors() ) ) {
$feed_display = new FeedDisplay( $feed, new Parser() );
return $feed_display->error_html();
}
$feed->get_set_cache();
$feed_display = new FeedDisplay( $feed, new Parser() );
return $feed_display->with_wrap();
}
Code file location:
reviews-feed/reviews-feed/class/Common/Services/ShortcodeService.php
Conclusion
Now that you’ve learned how to embed the Reviews Feed 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.
Leave a Reply