[sr_search_form]
– Let users search for listings on your site
The [sr_search_form]
short-code let’s you add a search form to any page on your website for your users to search and find MLS listings. This short-code is mostly commonly used with the [sr_listings]
to tie together the behavior of searching and viewing listings.
When this short-code is used, a search form will be added to the page like the example below. You can set default search parameters and restrictions on the search form, while the user can modify (some) search parameters and navigate results.
Syntax
This short-code can be used on any page, post, and anywhere else short-codes are allowed in WordPress.
Basic syntax:
[sr_search_form]
With options and filters:
[sr_search_form type="Rental" maxprice="2500"]
Options
This takes some options described to modify the output and behavior of the search form. Most of the useful options for this short-code are the search filters that control what listings the user sees in their results.
Name | Default | Description | Example |
advanced | false | Show an advanced search form with more filtering options. | [sr_search_form advanced="true"] |
Search filters
Search filters give you a way to set pre-defined search criteria for users searching for listings on your site. For example, you can use the brokers
filter to create a search form that searches your offices listings, or the minprice
/maxprice
filters to set initial values on the form.
Name | Default | Multiple | Description | Example |
vendor | null | false | The RETS vendor to search (required with multi-mls accounts). | vendor="har" |
limit | 20 | false | The number of results per page (max 500) after the user submits the form. | limit="500" |
brokers | null | true | Filter listings by broker MLS ID(s). | brokers="office1; office2" |
agent | null | true | Filter listings by agent MLS ID(s). | agent="agent1; agent2" |
water | null | Filter listings by a waterfront (or “true” for all waterfront listings). | water="Lake Name" | |
type | Residential; Rental | false | Filter listings by property type. | type="Condominium" |
subtype | null | true | Filter listings by property subtype. | subtype="Townhouse; ManufacturedHome" |
counties | null | true | Filter listings by counties. | counties="Harris; Montgomery" |
postalCoddes | null | true | Filter listings by zip codes. | postalCodes="77001; 77002" |
neighborhoods | null | true | Filter listings by neighborhoods. | neighborhoods="Garden Oaks; Towne Lake" |
cities | null | true | Filter listings by cities. | cities="Houston; Chicago" |
sort | Modifed, descending | false | Sort the listings on list date, price , # of bedrooms, or # of bathrooms. | sort="-listdate" |
q | null | false | A textual keyword search. Note: This populates the “keyword”. | q="Houston" |
status | Active; Pending | true | Filter listings by status. | status="Active; Closed" |
minprice | null | false | Filter listings by a minimum price. | minprice="500000" |
maxprice | null | false | Filter listings by a maximum price. | maxprice="1000000" |
minbeds | null | false | Filter listings by a minimum number of bedrooms. | minbeds="3" |
maxbeds | null | false | Filter listings a maximum number of bedrooms. | maxbeds="5" |
minbaths | null | false | Filter listings by a minimum number of bathrooms. | minbaths="2" |
maxbaths | null | false | Filter listings by a maximum number of bathroroms. | maxbaths="5" |
Example
The example below shows a basic search form with initial values for the minprice
/maxprice
options. The user can change these values and re-submit the form, try it below:
Raw short-code:
[sr_search_form minprice="100000" maxprice="500000"]
Output:
Search Listings
Example 2 (advanced search form)
This example demonstrates the advanced search form, which gives your users more options for finding listings on your website. (Note: some of the options below will populate with data from your MLS).
Raw short-code:
[sr_search_form advanced="true"]
Output: