Problem:
I'm trying to pre-populate a CRED form using URL parameters. So far, I've been able to pre-populate all forms except for taxonomies. I've tried using the slug as well as the term name. Is this something that can be done?
Solution:
I suggest you try these:
1) Pass term name as the URL parameter, for example:
<a href="http:/some-URL/?param-subject=[wpv-post-taxonomy type="subject" format="name"]">BUTTON IN SEARCH OF</a>
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy
2) In CRED form, use below JS codes to setup the default value in CRED field:
var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; var subject = getUrlParameter('param-subject'); jQuery('select[name="subject[]"]').find("option:contains('" + subject + "')").attr('selected', 'selected');
Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
This topic contains 5 replies, has 3 voices.
Last updated by aaronM-9 6 years, 1 month ago.
Assisted by: Luo Yang.