In this tutorial I’ll show you how you can create a new field for you listing and how you can search by it.
First, create Custom Field.
Let’s got to your wp-admin -> Listeo Editor – Fields. Here are 6 tabs with grouped fields. Only fields from Service/Rental/Event tab are automatically displayed in listing above the content. For fields in other tabs you’d have to modify single listing templates to show that field using get_post_meta()
Single template is in wp-content/plugins/listeo-core/templates/single-listing.php , to display value of custom field use code
<?php echo get_post_meta($post->ID, '_custom_field_id',true); ?>
Ok, let’s add field to service type named “Color”
and that should leave us with this options:
let’s say we want this field to be able to take multiple value, so change the Type to Multi Select.
In the Options table we’ll add the values for that select field.
please note the Name is what user will see, the Value is what will be saved in database, so try to not use any special characters for it.
With this new field defined, if we go to one of our listings in WordPress editor, we will see it as new field option:
Now let’s add it to Add Listing Form. Go to Listeo Editor -> Add Listing Form, scroll to section you want and click Add Field, and select the field we added
Now our Submit Listing form should present our new field:
The last step would be to make a filter from that field in the search forms. Let’s add it to sidebar search form. To do this, go to Listeo Editor -> Search Forms -> Sidebar Search tab, and from Available Searchable Elements in the right side, drag and drop the Colors field to the Main Elements. Save the changes, now edit the field again and make sure it’s set like on this screenshot
and here we go, working search form: