Difference between revisions of "JReviews:ShortCodes"

From JReviews Documentation
Jump to: navigation, search
(Listings shortcode)
(Reviews shortcode)
Line 130: Line 130:
 
|-
 
|-
 
| reviews_order || reviews_order="latest" || Available options: latest, helpful, random
 
| reviews_order || reviews_order="latest" || Available options: latest, helpful, random
 +
|-
 +
| my || my="1" || 0 - disabled, 1 - enabled. When enabled, if there's a logged in user the shortcode will only show his reviews.
 
|-
 
|-
 
| 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}.
Line 186: Line 188:
 
[jreviews type="reviews" review_order="latest" total="6" limit="6"]
 
[jreviews type="reviews" review_order="latest" total="6" limit="6"]
 
</pre>
 
</pre>
 
  
 
== Field Shortcode ==
 
== Field Shortcode ==

Revision as of 22:54, 13 May 2018

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:

Shortcodes-example.png

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
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


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:

Shortcodes-example2.png


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
my my="1" 0 - disabled, 1 - enabled. When enabled, if there's a logged in user the shortcode will only show his reviews.
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;?>