Hooks: Action and Filter reference

Introduction

Easy Property Listings has been developed with extensibility and modification in mind using hooks and filters. 

With this development requirement the plugin has been filled with filters and hooks that allow you to modify the plugins default behaviour.

Hooks are provided by WordPress and Easy Property Listings to allow your plugin or theme to ‘hook into’ the code; that is, to alter the default behaviour using filters or to insert additional elements into templates using hooks.

This for a WordPress developer is an essential requirement to meet the needs and wants of your real estate customers. 

This is even more handy if you are going to develop a number of real estate sites with similar functionality as you can bundle your customisations in a separate plugin to use on all your projects.

While there are a number of filters documented here in the codex in detail, these are only a tiny fraction of the 300+ filters and hooks. For details on what the hooks and filters do, reference the:

Filters and Hooks docs reference 

A number of the filters are dynamic in nature allowing you to make all kinds of alterations to the code base in Easy Property Listings. 

You can also search the plugin code on the GitHub repository.

Hooks and Filters

There are two kinds of hooks:

  1. Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. 
  2. Filters: Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. 

For examples see:  actions and filters

How to add custom functions using a custom plugin

We recommend you use download and customise the  epl-filters.zip plugin to store your modifications. This allows you to update the EPL plugin and retain your custom changes. You can also re-use your customisations on other websites you build too, saving a heap of time with endless flexibility.

How to add custom functions to the child theme

Since Easy Property Listings 3.3 the plugin will now look inside the active theme for a file called functions.php and load your functions, hooks and filters from there.

wp-content/themes/yout_active_child_theme/easypropertylistings/functions.php

NoteAlways use a child theme with WordPress.

How to add custom functions using a plugin

You can add a code snippets plugin to your WordPress site to add and manage code snippets like you will use when working with hooks and filters. Search the WordPress plugin directory for code snippets and install one.

Once installed you can create a new snippet and paste in the code snippet you need.

For example if you use the Code Snippets plugin and activated it visit the Snippets and Add New.

Save your snippet and review your changes. You can also easily manage all your snippets this way.

API Documentation

For a comprehensive view of the Easy Property Listings API, see the  API Documentation.