Difference between revisions of "JReviews:ShortCodes"
(→Reviews shortcode) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <div class="successbox" style="width: 95%"> | ||
+ | |||
+ | [https://www.jreviews.com/docs/shortcodes There's a new version of this article] | ||
+ | |||
+ | </div> | ||
+ | |||
JReviews Shortcodes allow you to embed listings or reviews inside an article text. | JReviews Shortcodes allow you to embed listings or reviews inside an article text. | ||
Line 27: | Line 33: | ||
|- | |- | ||
| listing_order || listing_order="rdate" || Available options: rdate, rating, rrating, topratededitor, reviews, random, featuredrandom, rhits, proximity | | 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 || summary="0" || 0 - disabled, 1 - enabled | ||
Line 71: | Line 79: | ||
|- | |- | ||
| compare || compare="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 | ||
|} | |} | ||
− | |||
'''Examples''' | '''Examples''' | ||
Line 131: | Line 142: | ||
| reviews_order || reviews_order="latest" || Available options: latest, helpful, random | | 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}. | | 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}. |
Latest revision as of 23:45, 8 July 2020
JReviews Shortcodes allow you to embed listings or reviews inside an article text.
There are two types of shortcodes:
- listings - reuses the functionality of the Listings Module
- reviews - reuses the functionality of the Reviews Module
- field - outputs a specific field from a listing
Listings shortcode
For example, this shortcode would display a listing with an alias "westville-east":
[jreviews type="listings" listing_alias="westville-east" summary="1"]
Inside an article that shortcode displays this:
There are many parameters that you can use:
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 file suffix. The default theme used is /modules/listings.thtml |
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="dir=2&cat=24&keywords=boston" | Custom Search Params |
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 |
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 |
Examples
10 top rated listings:
[jreviews type="listings" listing_order="rating" columns="2" total="10" limit="10" show_numbers="1"]
Latest listings from the category that has ID 23:
[jreviews type="listings" listing_order="latest" category="23" total="6" limit="6"]
Using Custom Search Params
Custom Search Params provide a simple way to filter listings by available search parameters.
Examples
All listings that have the keyword "Apple"
[jreviews type="listings" custom_params="keywords=Apple"]
All event listings in the next 7 days (based on the value in the jr_eventdate custom field):
[jreviews type="listings" custom_params="jr_eventdate=+7"]
Read this article for more examples on how to use Custom Search Params
Reviews shortcode
This shortcode would display reviews of a listing with an alias "westville-east":
[jreviews type="reviews" listing_alias="westville-east" link_title="{review_title}" show_comments="1"]
Inside an article that shortcode displays this:
Available parameters:
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 file suffix. The default theme used is /modules/listings.thtml |
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 |
Examples
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"]
Field Shortcode
The Field shortcode allows you to output a specific 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"]
The listing_alias attribute represents the listing from which you want to display the field value. You can also omit the listing_alias attribute and JReviews will auto-detect the listing from the current page (JReviews listing detail, view all reviews for a listing or review discussion pages) and output the correct value for that listing. Otherwise, the shortcode is removed and the output suppressed.
The listing_id attribute is the numeric ID for the listing from which you want to display the field value. This can be useful if you want to automatically retrieve fields for a listing specified via a related listing custom field. For example, in the events category, if you want to output the venue jr_state value somewhere in the detail theme file you can use the code below in your theme:
<?php if (isset($listing['Field']['pairs']['jr_venue'])):?> [jreviews type="field" name="jr_state" listing_id="<?php echo $listing['Field']['pairs']['jr_venue']['real_value'][0];?>"] <?php endif;?>