Hello,
I created a form with USP Pro where I have a custom field with a list of values (countries) that the user can pick from a dropdown.
The field is used like this in the post content: [usp_custom_field form="13339" id="4"]
Lower in the WordPress post editor, I created in the Custom Fields section the following definition for this custom field:
Name: [usp_custom_field form="13339" id="4"]
Value: data-required#field#select|options#null:Albania:Andorra:Armenia:Austria:Azerbaijan:Belarus:Belgium:Bosnia and Herzegovina:Bulgaria:Croatia:Cyprus:Czech Republic:Denmark:Estonia:Finland:France:Georgia:Germany:Greece:Hungary:Ireland:Italy:Iceland:Latvia:Lichtenstein:Lithuania:Luxembourg:Malta:Moldova:Monaco:Montenegro:North Macedonia:Norway:Poland:Portugal:Romania:Russia:San Marino:Serbia:Slovakia:Slovenia:Spain:Sweden:Switzerland:The Netherlands:Turkey:Ukraine:United Kingdom|option_default#Please Select..|option_select#null|label#Countries|multiple#true
I set this field to be mandatory and to allow multiple values chosen by the user.
The form is behaving as expected and I built it by following the documentation of USP Pro.
I also let the user submit one or more tags from a specific list of WordPress tags using a dropdown with [usp_tags label="My Label" include="Label One,Label Two,Label Three,Label Four,Label Five,Label Six" type="dropdown" multiple="true" required="true"]
.
Now, I am using the plugin Content Views Pro to list the user-submitted posts created with this USP Pro form.
I am using it for all the configuration options it offers for viewing posts in a gallery (I preferred it over USP Pro‘s gallery display).
I got it working, and I am able to view the posts (showing only title, part of the content, the thumbnail and the associated post tags) in a grid.
This plugin also lets me use a dropdown in its gallery functionality to filter the gallery using a set of tags, which is currently working for the tags which I let users choose in [usp_tags]
in the USP Pro form.
Now I am trying to create a dropdown in a Content Views Pro view to filter posts using the custom field [usp_custom_field form="13339" id="4"]
that I’ve shown above.
I am able to create the dropdown in the gallery using that plugin, and the plugin recognizes [usp_custom_field form="13339" id="4"]
, but in the gallery it does not load any of the select values (countries) I defined above.
I followed this example to create a filter dropdown from a custom field.
I’ve thought about converting all the countries to WordPress tags and include them in [usp_tags]
, but I want my current tags and the countries to be provided in different dropdowns and I can only use one [usp_tags]
per USP Pro form, so I think that idea does not work.
How can I (in child theme function override perhaps?) load the values of the custom field option [usp_custom_field form="13339" id="4"]
(defined in my USP Pro form) in the Content Views Pro plugin?
Any help would be amazing.
TLDR: if I create a USP Pro custom field that is a select with different option values, how can I load those values in a dropdown to use them as a filter in a view of the Content Views Pro plugin?
Thank you very much for your time and attention.