“I love the plugin, but can I change the details for my listings?”

This is a common question heard in the wordpress.org support forums – and yes it is possible!

* Note: This may get a little technical, but is totally doable by even the most novice user.

Using add_filter() to change the WP Listings default property details

Changing the listing details is actually quite easy, but will require a little bit of code added to your theme. WordPress has filter functions available to theme and plugin developers that allows them to change the output of another function.

In the WP Listings plugin we are using such a function, in the file class-listings.php with a line that starts like so:
property_details = apply_filters( 'wp_listings_property_details', array(

… and it then goes on to define those details.

The important part in that line is the apply_filters. Basically, we can add our own filter function that will be returned to the property details function instead of the default details.

For a little more in-depth, but still easy to understand, article on how filters work and how to use them check out Ian Stewart’s article on Using Filter Hooks in WordPress Child Themes.

So how easy is it? Here’s the code…

Before you get started, we always recommend you make a backup of your theme’s functions.php file before making any edits.

Say, for example, you want to remove the default of “Pool” and add “Garage” instead. By copying and pasting the code below into your theme’s functions.php file, you can do this.

That should get you started. If you look at the code, you’ll see it’s pretty self-explanatory of what the field labels are (i.e. “Bedrooms:”, “Bathrooms:”, and the new “Garage:”). If you change one of the field labels, you should also change the field name, which is at the end of each line and begins with “_listing_” – just keep it lower case and use underscores for spaces.

This will allow you to customize your listing details so they apply to your specific market, and not worry about any changes getting overwritten when the plugin is updated!

Listen to this post...
Voiced by Amazon Polly
Agent Evolution Real Estate Marketing Solutions

3 thoughts on “Change WP Listings Property Details

  1. Andrew says:

    Can we add fields that are not currently in the plugin with the same filter? Is there anything else needed to get the field to display?

  2. JM Das says:

    I have edited MLS# to “__( ‘Property Id:’, ‘wp_listings’ ) => ‘_listing_property_id’, ” . It’s showing up in the back end. Not seen in the View. Also other details that are edited are not showing . Only the Price details are showing.
    Thanks for any help

Comments are closed.