Hi. I'm trying to add some search dropdowns at the top of my archive page.
I've added the dropdowns following your tutorial but when I view frontend, the dropdown menus contain no choices.
Yet, on the back-end it indicates visually they will.
hidden link
Hi,
Thank you for waiting.
Based on reviewing your website's current setup and performing some tests on my website, this is what I'll recommend.
At the moment, the "Machine Types" post type is set to only hold a single custom field "Product Type" and it is linked to "Listings" post type, through a one-to-many relationship.
To be able to search the listings posts based on "Product Type", you can instead register a custom taxonomy "Product Type" and attach it directly to the "Listings" post type.
( from WP Admin -> Toolset -> Taxonomies )
As a result, you'll no longer need a seperate post type "Machine Types", its custom field "Product Type" or its relationship with listings. This will be simpler in terms of data entry too, since you'll not have to fill the same text like "Trailers" in two places, once as a "Machine Types" post's title and then as a custom field value for "Product Type" in it.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Thanks Waqar,
That sounds like a good way forward which I'll try.
With 'manufacturer', this was also a separate post type so I could bring in the logo of each manufacturer to display on each listing. Would recommend that I turn 'manufacturer' into a taxonomy also?
If I did this, how would I then get the appropriate to logo shown on each listing?
Regards,
Josh.
Hi Josh,
Thanks for the update and glad that it makes sense.
Yes, it would be a good idea to convert "manufacturers" into a custom taxonomy too.
You can register custom fields with taxonomies the same as with post types and users from WP Admin -> Toolset -> Custom Fields.
For storing logo information with each taxonomy term, you can register an image field with the newly created "manufacturers" taxonomy.
regards,
Waqar
Thanks Waqar.
And presumably this would be done by adding some custom code to functions.php, yes?
> And presumably this would be done by adding some custom code to functions.php, yes?
- If you're referring to my recommendation of storing logo information with each taxonomy term in the custom field, then no you won't need custom code for this.
After registering the "Manufacturer" custom taxonomy, you can go to WP Admin -> Toolset -> Custom Fields and switch to "Term fields", to attach an image field with this taxonomy for logo.
( screenshot: hidden link )
Thanks for this useful info. I'll give that a go. Many thanks.
My issue is resolved now. Thank you!