I have a CPT for "Products" with a few custom fields.
I have a CPT for "Countries" with a few custom fields.
I have a relationship 'many to many' between a Product and a Country
When I add a product in the front-end I have the list of the countries in my product form. When I choose a country it's searching and rebuilding the complete list. Is it possible to have it display as a selection list but like it was a "normal" selection custom field.
The country list is a CPT because it has to be in relation to many other CPT's but it's too slow to rebuild the list.
To avoid duplicate data here and there I work a lot with the relationships.
For this example: 1st-genre, 2nd-genre, 3rd-genre, original-aspect-ratio and original-picture-format are related to CPT's: "Genres", "Original Aspect Ratio", and "Original Picture Format". They are lists that will or not change or very not often.
I'd like to be able to display the as quick as it was a dropdown list in the form. Do you have a solution ?
If you are using post relationship form and if you want to set parent or child explicitly based on the parent or child information you have - you can set this but otherwise there is no such option to change the select2 to normal dropdown on post relationship form.
If you have one to many post relationship, when if you edit your form with "Expert Mode" enabled and to your relationship field add the following attribute to your parent field shortcode:
use_select2="never"
For example:
[cred_field field='@film-actor.parent' class='form-control' output='bootstrap' use_select2="never" select_text='--- not set ---' required='false']
But I'm afraid that it will work only when you use the select2. The order and ordering attribute will not supported when use add the attribute: use_select2="never"
use_select2 Optional. Used in parent select fields. Options are always and never. It will render the parent select field as a Select2 field or not, depending on the value set.
Works only on sites not using the new post relationships (legacy code). If used with new post relationships (Types 3,0+), it breaks the "order", "ordering" and "author" attributes. It can also break background checks like what post type to display in the select field for relationships. Warning: Do not use this attribute if not explicitly required.
Hello,
When you say "Warning: Do not use this attribute if not explicitly required." what does that mean exactly ?
Is there a security issue ? Any risk ?
No - no other risks using it. Just you have to compromise with the ordering as it will not respected or work when you use attribute:
- use_select2="never"