Taxonomy - field dependency
Show and hide custom fields according to the category that is chosen, so a trailer listing is never asked for its mileage and a VIN filter only turns up once a visitor is browsing cars.
2 minute read
Field dependency lets you show and hide specific fields on the search form and on the form for adding an ad, depending on the selected terms of a taxonomy.
Enable field dependency
-
1
Open the custom fields list
Go to Listivo Panel → Custom Fields and click Add New Field. To set the dependency on an existing field, skip the first two steps.
-
2
Name the field and set its type
Enter your field name and set Type to Taxonomy. Only this field type offers the dependency option.
-
3
Edit the new field
Find your new field in the custom fields list and click Edit.
-
4
Tick Field dependency
Mark the checkbox next to Field dependency and save your changes. Edit the field again and the relations table is waiting for you.
Reading the relations table
Across the top (1) are the category names; the first column (2) lists every field you can set a relation with.
By default the entire table has empty checkboxes. A row with no checkbox marked means the field is visible for every category, and so does a row with every checkbox marked (ex 1).
In the second example (ex 2), the fields are visible only in the categories you selected: Mileage is not visible for trailers, and Motorcycle features are visible only for motorcycles.
On the form for adding an ad
Below is the form as it looks for trailers. Mileage and transmission are nowhere to be seen.
On the search form
What is the difference between a row left empty and a row fully marked? A field whose row has no checkbox marked is on the search form immediately. A field whose row has every checkbox marked appears on the search only after a category has been picked.
The Make field is on the search form from the start. The VIN field is not.
The VIN field turns up once one of the categories is chosen — the car category, in the example below.
In short
- Field dependency is set per taxonomy field, in a relations table of categories against fields.
- A row with no checkbox marked, or with every checkbox marked, keeps the field visible for all categories.
- An empty row puts the field on the search form straight away; a fully marked row holds it back until a category is chosen.
- A field hidden for a category is hidden from every user, on the adding page and the listing page alike.
Keep reading
Ask the people who build MyHome
We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.
We can also run your site for you, or build a new one.
Was this guide helpful?