[listing_advanced] Shortcode
This Listing Advanced feature allows for you to output a list of listings by any number of custom configurations on your pages and posts using a simple Shortcode.
There are a variety of options available with this Shortcode in Easy Property Listings.
[listing_advanced]
Usage
There are several options that may be specified using this syntax:
[listing_advanced option1="value1" option2="value2"]
You can also print a list of listings in a template like so:
<?php echo do_shortcode('[listing_advanced option1="value1" option2="value2"]'); ?>
All Options
post_type status commercial_listing_type feature feature_id limit offset author agent featured open_house auction class wrap_template template location location_id tools_top tools_bottom sortby orderby_clause sort_order query_object pagination post__in post__not_in instance_id _{custom_field_name} _{custom_field_name}_{option}
Options
The following options are accepted:
post_type
specify which property type to display. The default is any activated listing type you have enabled. The option allows you to output multiple listing types by comma separating them "property,land"
. Default is any post type Options:
- property
- land
- rental
- rural
- commercial
- commercial_land
- business
[listing_advanced post_type="property,land"]
status
specify the listing status to output. The default will output all of the following status's.
Options:
- current
- sold
- leased
[listing_advanced post_type="property" status="sold"]This also works:
[listing_advanced status="current,leased,sold"]
Note: withdrawn and offmarket status are prevented from display.
commercial_listing_type
specify the type of commercial listing it is, lease, sale or both. The default will output all commercial listings.
Options:
- sale
- lease
- both
[listing_advanced commercial_listing_type="lease"]
feature
specify the username of the author to use when outputting listings:
[listing_advanced feature="close-to-shops"]
feature_id
specify the feature ID when outputting listings. Options:
[listing_advanced feature_id="1"]
limit
specify the number of listings that are output. The default is 10. For Example, to display 30 listings:[listing_advanced limit="30"]
offset
specify the number of listings to skip that are output. The default is 0. For Example, you can now use multiple shortcodes on a single page and offset them so each will display a unique listing:[listing_advanced offset="1"]
author
specify the username of the author to use when outputting listings:
[listing_advanced author="bob-smith"]
agent
specify the username of the agent to use when outputting listings. This will include both primary and secondary agents:
[listing_advanced agent="bob-smith"]
featured
specify the listing if it is featured when outputting listings. Options:
- 0
- 1
- on
- off
[listing_advanced featured=1]
open_house
specify if listings to be displayed have an up and coming open for inspection date. Default false:
- true
- false
[listing_advanced open_house="true"]
auction
specify if listings to be displayed are auction listings. Default false:
- true
- false
[listing_advanced auction="true"]
class
specify a wrapper class for the shortcode.
[listing_advanced class="my-custom-class"]
wrap_template
specify a wrapper template class for the shortcode. Used to render wrapper of listings render using shortcode. Default file is shortcode-listing.php. This can be overridden by placing a copy of shortcode-listing.php from plugins/easy-property-listings/lib/templates/content to your active_theme/easypropertylistings folder and and rename the file to shortcode-listing-{wrap_template}.php
[listing_advanced wrap_template="my-custom-class"]
template
specify the template to use when outputting listings. The default is the blog view. Options:
- slim
- table
- table_open
[listing_advanced template="table"]
location
specify the location of the listing so you can create a Sydney page and only output listings in that city. The option used is the location slug which works similar to post categories.
[listing_advanced location="sorrento"]
location_id
specify the location ID when outputting listings:
[listing_advanced location_id=1]
If you are filtering by the Suburb field which can be renamed to City or whatever, the way to actually use that value is by the category key called: property_address_suburb This also requires you to type in exactly as it appears in the box.
tools_top
specify outputting the grid and sort options. Default is off.
[listing_advanced tools_top="on"]
tools_bottom
for future use.
[listing_advanced tools_bottom="off"]
sortby
specify outputting the order of the listings. Default is sorted by published date newest first. Default is date. Options:
- price
- date
- status
- rand (Random sorting)
[listing_advanced sortby="price"]
sort_order
specify the order either ASC or DESC. Default DESC. Options:
- ASC
- DESC
[listing_advanced sort_order="ASC"]
orderby_clause
order by two different pieces of postmeta (for example, suburb first and state second).
[listing_advanced _property_bedrooms="2" _property_featured="yes" orderby_clause="property_bedrooms_clause|ASC,property_featured_clause|DESC"]
pagination
specify outputting the pagination options. Default is on.
[listing_advanced pagination="off"]
post__in
specify the WordPress post_id of the listings you want to display, multiple listings can be output. Default is blank.
[listing_advanced post__in="2,233,45"]
post__not_in
specify the WordPress post_id of the listings you do not want to display, multiple listings can be output. Default is blank.
[listing_advanced post__not_in="6,12,14"]
instance_id
specify the shortcode instance when using multiple shortcodes on a page, set the instance to implement separate paging. Default is 1.
[listing_advanced instance_id="2"]
Advanced Filtering Of Custom Fields
Query Any Meta Key just using shortcodes
[listing_advanced _property_bedrooms="2"]
Query Any Meta Key just using shortcodes - multiple meta query
[listing_advanced _property_bedrooms="2" _property_featured="yes"]
Compare Operations
The [listing_advanced] shortcode supports several compare operators that you can use to filter your listings with.
Using 'Min' in shortcode
[listing_advanced _property_price_min="200000"]
Using 'Max' in shortcode
[listing_advanced _property_price_max="200000"]
Using ' Not Equal' in shortcode
[listing_advanced _property_address_suburb_not_equal="sorrento"]
Using 'Like' in shortcode: Queries meta keys that contain a word/phrase (for example querying “red” would match the phrases “Red”, “looksred”, and “redstyle”)
[listing_advanced _property_checkbox_field_like="Level"]
Using 'Not Like' in shortcode: The opposite of above
[listing_advanced _property_checkbox_field_not_like="Sloping"]
Using 'Exists' in shortcode
[listing_advanced _property_showcase_exists="yes"]
[listing_advanced _property_auction_exists=""]
Using 'Not Exists' in shortcode
[listing_advanced _property_showcase_not_exists="no"]
Using ' Between' in shortcode: Queries meta keys where the value is between two numbers
[listing_advanced _property_bedrooms_between="2,4"]
Using 'Not Between' in shortcode: Queries meta keys where the value is not between two numbers
[listing_advanced _property_bedrooms_not_between="5,7"]
Using ' In' in shortcode: Queries meta keys where the value exists in an array
[listing_advanced _property_bedrooms_in="2,4,6"]
Works with text values too:
[listing_advanced _property_category_in="House,Apartment"]
Using 'Not In' in shortcode: Queries meta keys where the value exists not in an array
[listing_advanced _property_bedrooms_not_in="2,4,6"]
Ordering
Order By multiple meta query
NOTE: In order to use the orderby_clause the fields you are ordering must be part of the query.
E.G. in order to use property_bedrooms_clause you must also be using _property_bedrooms in the shortcode or any of the compare options: _property_bedrooms_exists="", _property_bedrooms_between="1,10" etc.
[listing_advanced _property_bedrooms="2" _property_featured="yes" orderby_clause="property_bedrooms_clause|ASC,property_featured_clause|DESC"]