[listing_results] Shortcode
Where it shows listings (3.6): on listing archives, search results and location or feature pages it shows that page's listings. On a normal page or post, and in a page builder editor, it shows the latest listings, with paging and sorting. On other archives (blog, author, other post types) it shows nothing, so a site-wide archive template that contains it doesn't fill them with listings.
Description #
The [listing_results] shortcode shows the listings of the page it is on: the search results, or the listings of a listing archive. Put it in your page builder's search results or archive template (Elementor, Divi, Bricks, Beaver Builder, WPBakery or Oxygen) to show EPL's listings there.
[listing_results]
It shows listings on:
- EPL search results.
- Listing type archives, such as
/property/or/rental/. - Location, feature and business category archives.
- Any other archive whose listings are EPL listings.
In a page builder editor there are no results yet, so it shows your latest listings while you design the template. On any other page it shows nothing.
Usage #
[listing_results option1="value1" option2="value2"]
Or in a PHP template:
<?php echo do_shortcode( '[listing_results tools_top="on" pagination="on"]' ); ?>
Options #
tools_top tools_bottom pagination template class title preview_limit
tools_top
Show the tools bar above the listings: sorting and the grid/list switch. on or off. Default off.
[listing_results tools_top="on"]
tools_bottom
Run the tools area below the listings (the epl_property_loop_end action). EPL adds nothing there itself; it is for add-ons and your own code. on or off. Default off.
[listing_results tools_bottom="on"]
pagination
Show the page numbers below the listings. on or off. Default on.
[listing_results pagination="off"]
template (3.6)
The listing template, as in the [listing] shortcode: card, slim, table or table_open, or the name of your own loop-listing-blog-{name}.php in your theme. Default: the normal archive template. The wrapper gets the class epl-template-{template}.
[listing_results template="card"]
class (3.6)
An extra class on the wrapper around the listings, for your own CSS. The wrapper always has the class epl-shortcode-listing-results.
[listing_results class="my-results"]
title (3.6)
Show the archive or search title above the listings, the same title EPL's own archive pages show (for example "Search Result"). on or off. Default off.
[listing_results title="on"]
preview_limit (3.6)
How many listings to show in a page builder editor. Default: Settings > Reading > Blog pages show at most. It has no effect on the live page, where the search or archive sets the number.
[listing_results preview_limit="6"]
For developers #
- epl_is_listing_results_page() decides whether the page shows listing results. Its filter lets you add your own archive.
- epl_is_page_builder_preview() decides whether a page builder editor is showing. Its filter lets you add another page builder.
- When there are no results, the shortcode runs the
epl_property_search_not_foundaction, the same message as EPL's search page (see epl_property_search_not_found).
Related #
Source #
lib/shortcodes/shortcode-listing-results.php, in epl_listing_results_loop_callback(). Since 3.5. The template, class, title and preview_limit options since 3.6.