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.

The following shortcode types are available at this time:

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 in proximity to current listing

When used in the listing detail page, it will auto-detect the current listing's location.

[jreviews type="listings" listing_order="proximity" radius="10" total="6" limit="6"]

Listings in proximity to custom coordinates

[jreviews type="listings" listing_order="proximity_custom" radius="50" custom_lat="42.3600825" custom_lon="-71.0588801" total="6" limit="6"]

**Listings in proximity to user (geotargeting) **

[jreviews type="listings" listing_order="proximity_geotargeting" radius="50" custom_lat="42.3600825" custom_lon="-71.0588801" 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;?>

Manage Listing

Since JReviews v3.12.0

The Manage Listing shortcode can show the listing manage dropdown. When placed anywhere within the listing detail page, the shortcode code format is:

[jreviews type="manage_listing"]

It's also possible to disable the dropdown and instead show a plain list of options:

[jreviews type="manage_listing" dropdown="0"]

When using the shortcode outside the listing detail page, it's necessary to indicate to the shortcode which listing the dropdown is for. To do this, pass the corresponding listing ID in the listing attribute.

[jreviews type="manage_listing" listing="23"]

Listing Cover

Since JReviews v3.13.3/v4.0.9

The listing cover shortcode allows displaying the listing cover in the listing detail page outside of the JReviews output. For example, in a Joomla module or WordPress widget.

[jreviews type="listing_cover" class="fwd-w-full fwd-h-96 fwd-object-cover"]

The shortcode allows using the class and style attributes to pass CSS classes and custom CSS styles so you can customize the output as needed.

Listing Favorites

Since JReviews v4.3.0

The Listing Favorites shortcode can show the favorites add/remove button. When placed anywhere within the listing detail page, the shortcode code format is:

[jreviews type="listing_favorites"]

When using the shortcode outside the listing detail page, it's necessary to indicate to the shortcode which listing the dropdown is for. To do this, pass the corresponding listing ID in the listing attribute.

[jreviews type="listing_favorites" listing="23"]

Listing MyLists

Since JReviews v4.3.0

The Listing MyLists shortcode can show the MyLists add-to-list button. When placed anywhere within the listing detail page, the shortcode code format is:

[jreviews type="listing_mylists"]

When using the shortcode outside the listing detail page, it's necessary to indicate to the shortcode which listing the dropdown is for. To do this, pass the corresponding listing ID in the listing attribute.

[jreviews type="listing_mylists" listing="23"]