[listing_category] Shortcode
This Listing Category feature allows for you to output a list of listings by any meta_key meta_value on your pages and posts using a simple Shortcode.
There are a variety of options available with this Shortcode in Easy Property Listings.[listing_category]You can output listings by a specific a specific meta key/value combination like this:
[listing_category category_key="property_bedrooms" category_value="3"]
Usage
There are several options that may be specified using this syntax:[listing_category option1="value1" option2="value2"]
You can also print a list of listings in a template like so:
<?php echo do_shortcode('[listing_category option1="value1" option2="value2"]'); ?>
All Options
post_type status commercial_listing_type category_key category_value category_compare limit offset author agent template location tools_top tools_bottom sortby sort_order pagination instance_id class
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"
Options:
- property
- land
- rental
- rural
- commercial
- commercial_land
- business
[listing_category 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_category post_type="property" status="sold"]This also works:
[listing_category 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_category commercial_listing_type="lease"]
category_key
This example we are filtering listings by House[listing_category category_key="property_category" category_value="House"]
This example we are filtering the Property listing type by Featured
[listing_category post_type="land" category_key="property_featured" category_value="yes"]Filtering by listing type is possible using:
[listing_category post_type="rental" category_key="property_bedrooms" category_value="3"]
category_value
The category_value also accepts multiple values separated by commas. category_value="2,3,4" or category_value="House,Unit"[listing_category category_key="meta_category" category_value="meta_value"]
filtering a listing by City/Suburb can be achieved using the location option.
category_compare
The category_compare allows you to perform a wide variety of comparisons with your listings to create the output that you are looking for. Default IN
This option supports both an array of values or a single value.
[listing_category category_key="meta_category" category_value="meta_value" category_compare="NOT IN"]
Array Compare Options when filtering by multiple values
- IN
- NOT IN
- BETWEEN // Used for numbers
- NOT BETWEEN // Used for numbers
EXAMPLE : IN - Display Listings that are both a House and Unit
[listing_category post_type="property" status="current" category_key="property_category" category_value="Unit,House" category_compare="IN"]
EXAMPLE : BETWEEN - Display Listings that are Current and BETWEEN the prices of $300,000 and $600,000
NOTE with BETWEEN: Place the numbers order higher to lower. 600000,600
[listing_category post_type="property" status="current" category_key="property_price" category_value="600000,300000" category_compare="BETWEEN"]
Single Compare Options when filtering by single values
- =
- !=
- >
- >=
- <
- <=
- LIKE
- NOT LIKE
- EXISTS // Used when a meta field exists. Requires WordPress 3.5+
- NOT EXISTS // Used when a meta field does not exists. Requires WordPress 3.5+
limit
specify the number of listings that are output. The default is 10. For Example, to display 30 listings:[listing_category 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_category offset="1"]
author
specify the username of the author to use when outputting listings:
[listing_category author="bob-smith"]
agent
specify the username of the agent to use when outputting listings. This will include both primary and secondary agents:
[listing_category agent="bob-smith"]
template
specify the template to use when outputting listings. The default is the blog view. Options:
- slim
- table
- table_open
[listing_category 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_category location="sydney"]
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.
[listing_category category_key="property_address_suburb" category_value="Kings Cross"]
tools_top
specify outputting the grid and sort options. Default is off.
[listing_category tools_top="on"]
tools_bottom
for future use.
[listing_category 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_category sortby="price"]
sort_order
specify the order either ASC or DESC. Default DESC. Options:
- ASC
- DESC
[listing_category sort_order="ASC"]
pagination
specify outputting the pagination options. Default is on.
[listing_category pagination="off"]
instance_id
specify the shortcode instance when using multiple shortcodes on a page, set the instance to implement separate paging. Default is 1.
[listing_category instance_id="2"]
class
specify a wrapper class for the shortcode.
[listing_category class="my-custom-class"]
Examples
Display Listings By Suburb
You can use either the taxonomy to display listings by suburb (however all content that has that suburb will display) or use the shortcode like this.
[listing_category post_type="property" category_key="property_suburb" category_value="albury"]
Display Listings By Exclusive Authority
[listing_category category_key="property_authority" category_value="exclusive"]