5. Using ATTRIBUTES to add filters to the SEARCH BAR
Why add filters? Attributes can be displayed automatically with your accommodation descriptions if you tick the “Visible in details” box. But importantly, if you wish, you can let customers search your accommodations using specific attributes or filters like room type, location, capacity, or price etc.... the filters are completely up to you to set.
There are basically 4 steps:
- ADDING THE ATTRIBUTES; your main filter types (e.g. LOCATION; ROOM TYPE)
- Adding the subcategories or 'terms' of those main filters. So for example, room type might break down into the terms single rooms, dorms, and studios
- MAPPING the relevant TERMS to your Accommodation types
- ADDING your attribute filters to the Search Bar.
1.ADDING THE ATTRIBUTES (FILTER TYPES)
First, decide on the categories or ATTRIBUTES you want people to be able to see as details, or as a further step, be able to filter your accommodations by in their searches. Examples: location, price groups, room type and so on.
- In your admin, open ACCOMMODATIONS.
- Now click on ATTRIBUTES under ACCOMMODATIONS.
3. Add each attribute (e.g. LOCATIONS) as the title; no need to duplicate the name in the Default text box: it will automatically duplicate. Then click on update.
- Repeat this for each attribute.
2.ADDING THE RELEVANT TERMS TO YOUR ACCOMMODATION TYPES
- Click on ATTRIBUTES again to see the list of the attributes you've just made; and on the right, click on CONFIGURE TERMS.
- Here's where you add each of the TERMS or subcategories of your attributes that you want to allow your customers to select from. So the terms for LOCATION for example, could be Paris, Auckland, and London.
- Add each of your terms for every attribute; and make a note of the slugs in the middle column - you'll need them for later.
3.MAPPING THE TERMS TO THE RELEVANT ACCOMMODATIONS
- Go to ACCOMMODATION TYPES, and click EDIT (not Edit with Elementor) on your first accommodation type.
- Then scroll right down until in the right column, you see the section headed ATTRIBUTES. Click to put a tick or checkmark in each box beside the specific terms relevant for that accommodation type.
- Repeat this for every accommodation type.
4.USE YOUR TERMS AS FILTERS IN YOUR SEARCH BAR
The terms you've made will show as additional details on each accommodation description. However, you may want to go a step further and add a bit of magic with them: you can add your terms to your SEARCH bar, as filters for customers to use! You can add the attributes as fields to your SEARCH bar which will filter the results to match them closely to what the customer wants. You can add filters such as number of adults, location, days available - in fact just about anything you want to add.
- In order to add extra fields to your search bar, first of all you need to add the details by way of attributes. So under ACCOMMODATION go to attributes in admin.
- Click on add ’NEW”. This is where you add the main filters that you want, such as location, room types and so on. And on the right is the little box where you can choose the order in which they’ll appear.
- Complete as many as you need, in the same way. Once you’ve finished, it’s time to add the terms for each filter. Simply click return each time to add another term.
- Make a note of the slugs that you can see in the middle column; here we see room types and location.
- Now head on over to your first accommodation type in admin, open with EDIT, and scroll right down to ‘attributes’ in the right hand column. Put a check in the ones to activate for that specific accommodation type. Remember to update!
- Repeat this for every accommodation type that you have.
4.Adding the filters to your SEARCH bar
For our last step with attributes, we need to actually add add the new search bar to any pages where you want it to show. Here we're going to add it to our homepage.
So after opening the homepage from PAGES in admin, let's add a completely new search form, so that you'll be able to compare it with the original one above.
- Add a new section, and click on the + at the top left to open the widgets/elements column. Slide right down in the left-hand column to the ‘Motopress hotel booking’ section, and drag the ‘Accommodation Availability’ search widget into place. (You can alternatively use the SEARCH 'Search Availability Form just below that; it has slightly different settings options such as vertical versus horizontal layout.)
2, On the left you can now customise your form. We're going to add the slugs we noted earlier. Here we’re adding ‘room types’ (note the hyphen in between the words), and ‘location’. Separate yours with commas, and add a space after each one.
- Now let's have a look at the actual live site on the front end…. and, then we’ll do a test run. Here you can see the old SEARCH bar above our new search bar, with its additional fields for LOCATION and ROOM TYPE.
.SUCCESS! The final result shows any accommodations meeting those criteria. Done.