Sign up to Our

NEWSLETTER


 
To answer your question faster, you can search our knowledgebase articles before submitting a ticket.
Knowledgebase
How to filter listings using WPL shortcode?
Posted by Howard R. on 17 October 2016 02:32 AM

WPL has a flexible shortcode so you can do almost everything that you need for filtering listings using this shortcode. Let's check WPL shortcode structure.

[WPL parameter1="value1" parameter2="value2" ....]

for filtering your desired listings you can simply use parameters. For example placing sf_select_listing="9" will filter "For Sale" listings. As you can see this parameter have 3 parts, Let's see what are these parts.

sf

All filtering parameters start with sf prefix.

select

It's operand of your query, you can use following operand types:

select: It uses for looking for a certain value into the listings. For example sf_select_property_type="6" will create `property_type`="6" into the query for finding the listings that have "Apartment" for their property_type column.

notselect: It acts as opposite of select. It adds `property_type`!="6" into the query for finding the listings that are not "Apartment".

multiple: If you want to look for a multiple values, you can use this operand. For example sf_multiple_listing="9,10" looks for listings that are For Sale and For Rent by creating `listing` IN (9,10) query.

text: If you want to search on a listings with a term, then you can use this operand type. for example sf_text_field_312="Johnson" generate `field_312` LIKE '%Johnson%' for finding all listings that have "Johnson" term into their title.

tmin: You can use it for numeric filters. For example if you place sf_tmin_bedrooms="2" into the shortcode, then it will add `bedrooms`>='2' to the query for finding listings that have more than 1 bedroom.

tmax: It acts like tmin but for maximum search. For example if you place sf_tmax_bedrooms="2" into the shortcode, then it will add `bedrooms`<='2' to the query for finding listings that have less than 2 bedrooms.

between: It's a combination of tmin and tmax. For example if you place sf_between_bathrooms="1:3" into the shortcode, then it will generate `bathrooms`>=1 AND `bathrooms`<=3 into the query.

datemin and datemax: They act like tmin and tmax operands but for date fields.

listing

The third part is column name, You can find the column name in the dbst table for your desired field.

Note: You can insert multiple filtering parameter into the shortcode.


Comments (0)