I'm building a medicinal plants website, I'd like advice on what field type to use - taxonomy, custom field or what.
I've attached a description of the posts and fields and would really appreciate advice on what field types to use.
Thanks
David
Hi, the main difference between using a custom field and using a taxonomy is archives. WordPress automatically creates archives for each taxonomy term at a URL like yoursite.com/taxonomy/term, which hold a list of all posts where that term is applied. That list is syndicated to your feed URLs. Custom fields do not have automatic archives, so you would not have automatic archive lists created for those.
There are some limitations to using custom field values in conditionals, as described in the conditional documentation here:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
There are also some nuances to the types of inputs that can be used for each custom field type in a custom search View or in a Form. For example, there is no auto-suggest field type in Forms for custom fields, but it does exist for terms in flat taxonomies.
Other than that, I'd make these recommendations:
P1: Title: Use the title field
P2: ID: WordPress will automatically generate a unique ID for each post. You can use that ID or you can create a numeric custom field that stores your own existing ID.
P3: Family: could easily be a taxonomy or a custom field. If hierarchy is needed, a hierarchical taxonomy probably makes the most sense. If it's not hierarchical, then you could use plain text, or radio, or select. Radio and select require you to predefine all the possible options in wp-admin. Plain text does not, but it also allows for inaccurate options like misspellings of the same Family.
P4: Common names: There are many options here. It could be a single line field that holds all the values. It could be a single line field that allows multiple instances. It could be a multline field. It could be a checkboxes group, but you would have to predefine every possible option in wp-admin. Or, it could be a taxonomy if you will be using the same names in many plants.
C1: Title: Use the title of the post
C2: Plant ID - if you want to create post relationships between two posts, it's easiest to use a post relationship. However, if you just want to use numeric IDs to relate posts, that's fine. You would use a numeric field here. The problem is maintenance, because you must know the related post's ID (there is no ability to search by post name to find the ID in the input field).
C3: Complaint ID: Use the post ID or a numeric field containing your own existing ID.
C4: System effected: Use a radio or select field, or a taxonomy.
C5: Medicinal Actions: Use a multi select field or a checkboxes group or a taxonomy
C6: Prep Admin: WYSIWYG field or multi-line field
C7: Plant parts: Use a multi select field or a checkboxes group or a taxonomy
C8: Source: Single line text, radio, select, or taxonomy.
Let me know if you have questions about this.
Hi Christian,
Thanks for your detailed reply, much appreciated.
Just so I understand, if I have a list of terms in a field how do I ensure each term is treated as a separate item - do I need to comma separate the terms, can I pre-format the terms in a list by loading them in a csv file as term1<br/>term2<br/>term3 .
Seems to me that apart from titles, ID Nos. and multi-line text (not lists of terms), the most flexible option would be to define fields as flat taxonomies which would also allow me to search for terms using auto-suggest. Is this correct?
Is there any documentation that gives a summary of all the different field types with examples of use?
Thanks for your help
David
Just so I understand, if I have a list of terms in a field how do I ensure each term is treated as a separate item
If you're talking setting up about a radio field or a select field or a group of checkboxes, you define each of those options individually in the custom field builder manually. Here is a screenshot showing an example of one of those custom field editors showing 3 options for a radio field.
Documentation on the different field types:
https://toolset.com/documentation/customizing-sites-using-php/functions/
You can also create a free account at https://discover-wp.com/ to set up any of our sandbox sites, where you will have access to wp-admin and you can test different field types and taxonomy configurations.
Seems to me that apart from titles, ID Nos. and multi-line text (not lists of terms), the most flexible option would be to define fields as flat taxonomies which would also allow me to search for terms using auto-suggest. Is this correct?
"Most flexible" is a bit subjective, but you are correct that a flat taxonomy allows you to search for terms using auto-suggest.
Thanks for this,
how do I upload a list of terms to a taxonomy field from a csv file and ensure each term is treated
separately do I need to comma separate the list - "term1, term2, term3"
or could I preformat the list for display - "term1<br/>term2<br/>term3"
Thanks
David
Toolset doesn't provide the ability to import taxonomy terms using a CSV, nor does it provide the ability to import posts. You could use a 3rd-party import tool to import terms after you set up the custom taxonomy in Types. That's probably the most straightforward solution. Another workaround if the terms already exist in another site is to create one post in some custom post type and apply all the possible terms to that post. Then export those custom posts using the WordPress export tool, and the terms will be exported along with that post. When you import that post export file using the WordPress import tool, the terms will be imported. You should set up the custom taxonomy first in the new site using Types, making sure the taxonomy slugs match up in both sites.
My issue is resolved now. Thank you!