Search Templates

The listing_search shortcode and widgets support custom templates which can be created and loaded from your active theme. This will allow you to implement custom search templates which are selectable from the EPL - Listing Search widget or using the [listing_search] shortcode.

Implementation

Register your templates with the epl_search_widget_fields filter.

<?php
/**
 * Add custom templates for search
 */
function my_epl_custom_search_widget_templates($fields) {

	$fields[] = array(
		'key'		=>	'view',
		'label'		=>	__('View','easy-property-listings'),
		'default'	=>	'default',
		'type'		=>	'select',
		'options'	=>	array(
			'default'	=>	__('Default' , 'easy-property-listings'),
			'custom'	=>	__('Custom' , 'easy-property-listings'),
			'side'		=>	__('Side' , 'easy-property-listings'),
			'home'		=>	__('Home' , 'easy-property-listings'),
		)
	);
	return $fields;
}
add_filter('epl_search_widget_fields','my_epl_custom_search_widget_templates');

Add the templates to your active theme in the following folder.

your_active_theme/easypropertylistings/shortcodes/listing-search/

So using the example above your template files in the folder will be:

  • default.php
  • custom.php
  • side.php
  • home.php

Widget Usage

Once the filter is implemented you will now see a View option present in your EPL - Listing Search shortcode allowing you to select the template you want.

Shortcode Usage

You can also select the template with the view option in the [listing_search] shortcode.

  • [listing_search view="{template_name}"]
  • [listing_search view="home"]

Creating the Search Template

In the Easy Property Listings plugin the templates are located in: 

/plugins/easy-property-listings/lib/templates/content/shortcodes/listing-search/ (follow the link to see these files on github)

Copy the contents of the default.php file and use as a starting point for your custom search. Place the file in your_child_theme/easypropertylistings/shortcodes/listing-search/ folder.