Shortcodes

Shortcodes are a great way to show JReviews content anywhere on your site. In other Joomla components and WordPress plugins, banner custom fields and even in your template customizations.

Overview

Shortcodes are another way to surface JReviews content on the site, in addition to Joomla modules, WordPress widgets, detail page related listing widgets, and custom embed options.

Thereare three shorcode types available at this time:

  • listings
  • reviews
  • field

Listings Shortcode

Under the hood, this shortcode makes a request to the same code used by the listings Joomla module and WordPress widget. Below you can find a few examples of how to use it:

Single listing with an alias "westville-east"

[jreviews type="listings" listing_alias="westville-east" summary="1"]

Custom Search Params provide a simple way to filter listings by available search parameters.

All listings that have the keyword "Apple"

 [jreviews type="listings" custom_params="keywords=Apple"]

All event listings in the next 7 days

 [jreviews type="listings" custom_params="jr_eventdate=+7"]

10 top rated listings

[jreviews type="listings" listing_order="rating" columns="2" total="10" limit="10" show_numbers="1"]

Latest listings filtered by category

[jreviews type="listings" listing_order="latest" category="23" total="6" limit="6"]

Listings Shortcode Attributes

There are many attributes you can use to customize the output of the listings shortcode:

Parameter Example Description
listing_alias listing_alias="westville-east" Alias of a specific listing
listing_order listing_order="rdate" Available options: rdate, rating, rrating, topratededitor, reviews, random, featuredrandom, rhits, proximity
user user="mine" "mine" - logged in user, integer - specific user id - shows listings of logged-in user or specified user id
summary summary="0" 0 - disabled, 1 - enabled
summary_words summary_words="10" Number of words
show_category show_category="0" 0 - disabled, 1 - enabled
fields fields="jr_state,jr_city" Comma separated list of custom fields to show
editor_rating editor_rating="0" 0 - disabled, 1 - enabled
user_rating user_rating="1" 0 - disabled, 1 - enabled
tmpl_suffix tmpl_suffix="_vertical" Theme suffix
tn_show tn_show="1" 0 - disabled, 1 - enabled
tn_position tn_position="left" Available options: left, right, top, bottom
tn_mode tn_mode="scale" Available options: crop, scale
tn_size tn_size="100x100" Thumbnail size in WIDTHxHEIGHT format
cat_auto cat_auto="0" 0 - disabled, 1 - enabled
dir dir="1" Directory IDs
category category="22" Category IDs
listing listing="51" Listing IDs
custom_params custom_params="cat=24&keywords=boston" Custom parameters
nav_position nav_position="bottom" Available options: bottom, side
orientation orientation="native-scroll" Available options: horizontal, vertical, fade, native-scroll, native-scroll-paginated
total total="10" Max. number of results
limit limit="5" Results per page
columns columns="2" Number of columns
show_numbers show_numbers="0" 0 - disabled, 1 - enabled
compare compare="0" 0 - disabled, 1 - enabled
extension compare="com_easysocial" Default is com_content for native JReviews listings. If you want to retrieve a listing that is included via the Everywhere Add-on, specify the extension name with this attribute.
themelayout themelayout="layoutID" Refer to the Layout Customizer / Module - Widget in the JReviews dashboard to find the right layout ID you can use with this attribute

Reviews Shortcode

Below you can find some usage examples for the reviews shortcode.

Reviews for a single listing with alias "westville-east"

 [jreviews type="reviews" listing_alias="westville-east" link_title="{review_title}" show_comments="1"]

10 most helpful user reviews

[jreviews type="reviews" reviews_order="helpful" reviews_type="user" columns="2" total="10" limit="10" show_numbers="1"]

Latest reviews

[jreviews type="reviews" review_order="latest" total="6" limit="6"]

Reviews Shortcode Attributes

There are many attributes you can use to customize the output of the reviews shortcode:

Parameter Example Description
listing_alias listing_alias="westville-east" Alias of a specific listing
reviews_order reviews_order="latest" Available options: latest, helpful, random
user user="mine" "mine" - logged in user, integer - specific user id - shows reviews of logged-in user or specified user id
link_title link_title ="{review_title}" You can use the {listing_title} and {review_title} tags to build your link title output. You can also specify the total number of characters to show (including the ... at the end), by adding the number inside the tag like this {listing_title 10} - {review_title 15}.
reviews_type reviews_type="all" Available options: all, user, editor
show_comments show_comments="0" 0 - disabled, 1 - enabled
comments_words comments_words="10" Number of words
fields fields="jr_pros,jr_cons" Comma separated list of review custom fields to show
tmpl_suffix tmpl_suffix="_vertical" Theme suffix
tn_show tn_show="1" 0 - disabled, 1 - enabled
tn_position tn_position="left" Available options: left, right, top, bottom
tn_mode tn_mode="scale" Available options: crop, scale
tn_size tn_size="100x100" Thumbnail size in WIDTHxHEIGHT format
extension extension="com_jreviews" Name of the extension from which reviews will be displayed. Required when using filters below.
cat_auto cat_auto="0" 0 - disabled, 1 - enabled
dir dir="1" Directory IDs
category category="22" Category IDs
listing listing="51" Listing IDs
nav_position nav_position="bottom" Available options: bottom, side
total total="10" Max. number of results
limit limit="5" Results per page
columns columns="2" Number of columns
show_numbers show_numbers="0" 0 - disabled, 1 - enabled

Field Shortcode

The Field shortcode can show the output of a single field from any listing anywhere on the site. The shortcode format is:

[jreviews type="field" name="jr_state" listing_alias="blue-hill"]
[jreviews type="field" name="jr_state" listing_id="111"]

You can specify the listing for which you want to show the field using the listing_alias or listing_id attributes.

You can also omit these and the shortcode will try to auto-detect the listing from the current page (listing detail, view all reviews for a listing or review discussion pages). If a valid page cannot be auto-detected, the shortcode is removed and the output suppressed.

If you place the shortcode in a template file, you can combine it with custom PHP code. For example, in an event listing type, you can inject the venue related listing ID into the listing_id attribute to show venue custom fields in the event page.

Show venue address in event page

<?php if (isset($listing['Field']['pairs']['jr_venue'])): ?>

  [jreviews type="field" name="jr_address" listing_id="<?php echo $listing['Field']['pairs']['jr_venue']['real_value'][0];?>"]

<?php endif;?>