How do I use shortcodes to filter IDX API results?

To filter results from the IDX API based on specific parameters, start with the shortcode [idx_results] and then pair it with an attribute. There are all kinds of attributes you can use depending on what you want to display (scroll down for a full list).

For example, if you wanted to sort listings by zip code, the shortcode would look like this:

[idx_results zip=”30342,30305,30326”]


When this shortcode is applied, it will produce all listings found within the zip code areas of 30342, 30305 and 30326. You can even add more zip codes to this result if you like — just separate each number with a comma.

To further illustrate the flexibility of shortcodes, let’s add in a few more attributes:

[idx_results sort="false" zip="30342,30305,30326" options="pool"]


Let’s break it down. We already know the shortcode will produce listing results for the given zip codes, but what about those two other attributes — sort and options? By adding sort=”false” and options=”pool” to the shortcode, you’re hiding user controls for sorting listings and calling up listings that feature swimming pools.

Let’s try another example. Want to filter by subdivision?

[idx_results subdivision="Beach Club Garden Residences"]


In the shortcode above, all listings from Beach Club Garden Residences subdivision will appear in the results.

One last example! Let’s try filtering by city and type of property.

[idx_results type="Residential" city="bridgewater"]


With this shortcode, users will only be shown Residential listings located in the city of Bridgewater.

What attributes can I use with [idx_results] shortcodes?

Whether you want to filter by location, schools or price, you have a lot of options! Here’s a little cheat sheet:

* = These shortcodes can accept multiple comma-separated value

  • *broker_id — Filter results to show only listings that belong specific broker id.
  • *agent_id — Filter results to show only listings that belong to a specific agent ID. Can be used in conjunction with broker_id.
  • *street — Filter results based on street
  • *city — Filter results based on a city or cities.
  • *zip — Filter results based on zip code(s)
  • *county — Filter results based on county or counties.
  • *subdivision — Filter results by subdivisions. Names sensitive to spaces and capitalization.
  • *area — Filter results by MLS Area
  • *mls — Filter results by which MLS they are listed on.
  • *type — Specify listing types that will be included (example — Residential, Commercial, Lots & Land)
  • *exclude_type — Reverse of type. Exclude a specific type or types of listings from results. Not recommended to use type and exclude type at the same time.
  • limit — Set a restriction on the total number of listings displayed across all pages. Single numerical value.
  • options — Filter results based on features like "pool," "new construction," "basement," among others.
  • minprice — Set a minimum price for results. single flat number recommended no '$' or ','
  • maxprice — Set a maximum price for results. single flat number recommended no '$' or ','
  • template ( default | False ) — Specify the template to be used for displaying listings. Format: file_name.php. When creating templates individual listing information is available through the $listing variable.
  • *high_school — Filter results by high school(s). Names sensitive to spaces and capitalization
  • *middle_school — Filter results by middle school(s). Names sensitive to spaces and capitalization
  • *elementary_school — Filter results by elementary school(s). Names sensitive to spaces and capitalization
  • *view — Filter results by view. Not available for all MLS
  • sold ( default | False ) — Set query to return only listings with the status of Sold. Accepts either True of False.
  • sort ( default | True ) — Toggle if the sorting controls will be displayed.
  • shuffle ( default | False ) — Set to True to have results returned in a random order.
  • pagination ( default | True ) — Display pagination for results
  • sticky_broker_id — Listings that belong to the specified broker id will be pinned to the top of the 1st page of search results.
  • sticky_agent_id — Listings that belong to the specified agent id will be pinned to the top of the 1st page of search results.
  • wrapper_id (default | 'idx-results' ) — Specify a specific ID for the HTML container of results.
  • cache ( default | True ) — Specify if the transients API should be used to cache shortcode results. If this query is thought to be in a 'low traffic' location it is recommended to set this to false.
  • seller_id — Filter results based on selling agent ids. This parameter sets up an OR condition that will look for the supplied ID(s)
  • unscope ( default | False ) — Setting this to True will allow the query that is run to reach beyond the scope set by the client API key. This option is not recommended
  • disclaimer ( default | True ) — Display MLS Listing disclaimer. Which disclaimer is displayed is controlled by the SW_IDX_MLS constant in wp-config.php

Still need help? Contact Us Contact Us