Hi Robert,
Thank you for waiting while I worked on the demo website and I apologize for the delay in getting back to you.
The demo website is ready and can be accessed at:
hidden link
It is a fairly basic setup that matches filter fields used on your motorfind.co.uk website. Search filters and results are using built-in features available in Toolset plugins and no custom PHP code was involved in its making.
The snapshot/clone of the website can be downloaded from this link:
hidden link
This snapshot was created using the Duplicator plugin ( http://wordpress.org/plugins/duplicator/ ) and you'll find the instructions on how to deploy this snapshot on your own server, in this video:
hidden link
Access details for the snapshot's admin access after it has been deployed:
Username: MFadmin
Password: MFadminMFadminMFadmin
My recommendation would be to first deploy this snapshot on your server and then read through the steps explained below. With a live example and back-end access, you'll get a better understanding.
To make the website, I worked with the following components:
1. Custom post types:
Three custom post types were used:
a). Listings: These will hold the actual listings for each car entry.
b). Car Companies: These will hold individual car manufacturers which will be used for the "Make" filter.
c). Car Models: These will hold individual car model names which will be used for the "Model" filter.
2. Post relationships:
To have AJAX loading filter for the "Model" field, which is linked to "Make" field, taxonomies can't be used, since they can't be linked together. For this reason, custom post types were used which were then connected with one another, through a one-to-many relationship.
Two post relationships were created:
a). "Car Companies" were linked to "Car Models" through a one-to-many relationship. This means that each car company can have multiple car models, but each car model can only have one car company.
b). A second one-to-many relationship was created between "Car Models" and "Listings". This means that each car model can be used with multiple listings, but each listing can only have a one car model.
3. Custom field group
A new custom field group named "Car Details" was created and set to show only on "Listings" custom post type.
It included custom fields for rest of the filters, namely:
- Fuel
- Mileage
- Price
- Year
- Private or Trade
- Transmission
- Body Type
- Colour
4. Post View
The actual search filters and listings are being displayed on the front-end using a View. It can be created from WP Admin -> Toolset -> Views. When "Add New" button is clicked, a couple of options are shown to best describe the purpose of the view ( screenshot: hidden link ). I selected the option "Display the results using a custom search".
You'll find only one view in the list named "Car Search View", which is showing the list of cars along the search filters on the homepage.
a). On the view's edit screen, I selected "Listings" as a post type to show the list from.
( screenshot: hidden link )
b). The search filters which are shown above the lists were inserted in the "Search and Pagination" section, in the same view.
c). The design or format of how each car list item is shown on the front-end is controlled through the code and fields added in the "Template for this View" section.
5. Showing the created view on the homepage
a). I created a new page named "Home" and selected it as a static Homepage from WP Admin -> Settings -> Reading.
b). On that page's edit screen, I used the "Fields and Views" button, to insert the shortcode to display this view on the page.
( screenshot: hidden link )
My recommendation would be to see how the view, custom post types, custom fields, and post relationships are set up on the demo website and then try to add some new views, to explore and experiment with the different available options.
If you have any specific questions related to any element shown in that demo website, please let me know.
I hope this helps!
regards,
Waqar