How to register additional EPL - Listing widget templates

Included in Easy Property Listings is a template loading system that allows you to register and load additional widget templates from your child theme.

Setup your theme template folder

First create a directory inside your theme/child theme folder called {YOUR_THEME}/easypropertylistings/

Next copy the default widget template file from the plugin located in plugins/easy-property-listings/lib/templates/content/widget-content-listing.php and place it into the easypropertylistings folder you created inside your theme.

Rename the file from widget-content-listing.php to widget-content-custom.php where custom will be your new template name.

Register your new template with the widget

You will need to register your new template with the widget so you can select it.

Use the following filter to register your custom widget, you can register as many as you need.

<?php
/**
 * Add additional widget templates
 *
 * @return array
 */
function my_epl_listing_widget_templates( $templates ) {

	$templates['custom']   = 'Custom';
	$templates['one_more'] = 'One More';

	return $templates;
}
add_filter( 'epl_listing_widget_templates', 'my_epl_listing_widget_templates' );

Using your custom widget templates

Once you register your function you can select your new template from the widget settings.

All you need to do is edit your widget-content-listing-custom.php file as required.

Add as many custom widget templates as you need following the same process.

widget-content-listing-{CUSTOM_TEMPLATE_NAME}.php
widget-content-listing-custom.php
widget-content-listing-one_more.php