Conditional Fields

Show or Hide fields when conditions are met

GeoDirectory version introduces a new, highly anticipated feature:

Conditional Logic for Custom Fields

This new feature allows you to create dependencies between fields, based on the conditions that you set.

Dependent fields will only be displayed and editable, if the input entered on the fields they depend on, matches the right conditions.

This feature is fundamental for business directory listings, with many custom fields making it possible to select preset fields only when these apply.

An easy-to-understand example is represented by custom fields for Car Classified Listings.

Presumably, you will have a field labeled “Brand”, where users will select their car manufacturers such as Ford, GMC, or Lamborghini.

And you will have a field labeled “Models“, where you select the model of the selected Brand of cars. If you select Ford, this field will display models such as C-Max, Fiesta, Focus, Fusion, Mustang, and so on.

If you select Lamborghini, this field will display models such as Huracan, Aventador, Gallardo, Murcielago, Diablo, and so on.

Car Classified Brand/Model conditional fields

To create this example, we added 3 custom fields to our setup. Brands, Ford Models, and Lamborghini Models.

On the Ford Models Field, we set the condition to show only when you select the Ford option in the Brands field.

On the Lamborghini Models Field, we set the condition to show only when you select the Lamborghini option in the Brands field.

It is as easy as that.

Another case in point would be Real Estate Listing.

Let’s show a full tutorial, including how to set up the fields, using our WordPress Real Estate Theme.

Conditional Fields for Real Estate Listings

Our Real Estate listing demo includes a field labeled Property Type with options such as Houses, Apartments, and Land and another field asking for furnished/unfurnished status. Obviously, the second field never applies to Land properties.

In this case, we will add a Conditional Logic to the Furnishing select custom field by doing the following:

1. Open the Furnishing Select Field.

2. Click the “+ Conditional Field” link at the lower-left corner of the custom field options.

3 After clicking on it, a new set of options will appear.

4 For our example, we will need to set them as follows:

  2. FIELD = Property Type
  3. CONDITION = equals to
  4. VALUE = Land

and save the custom field. Below you can see what this will look like.

After doing that, this is the result on the Front End:

Real Estate Conditional Fields

The same conditions can be added to other fields like the bedrooms or bathrooms fields, which are not needed if you are listing a piece of land.

You can also add multiple conditions if you need to do so.

The available options are:

  2. FIELD = All your fields
  3. CONDITION = empty, not empty, equals to, not equals, greater than, less then, contains.
  4. VALUE = accept text

And you can add as many as you wish for each field.

What are you going to build with GeoDirectory conditional custom fields?

Let us know in the comment down below…

Unlock the Power of GeoDirectory!

Start your Online Business Now

Join Today!

Newsletter - Stay Updated!

Get the latest news, tips, and exclusive content directly in your inbox.

Published by Paolo

Paolo Tajani, co-founder and marketing lead at AyeCode LTD, works alongside his business partner Stiofan to develop key WordPress plugins such as GeoDirectory, UsersWP, and GetPaid. Starting his journey with WordPress in 2008, Paolo joined forces with Stiofan O'Connor in 2011. Together, they have been instrumental in creating and marketing a range of successful themes and plugins, now actively used by over 100,000 websites.