Problem: I have a page on my site that displays information about a User using Types and Views shortcodes. This works fine when I want to show information about the current User, but I cannot figure out how to show information about a different User.
Solution: Use a URL parameter to define the variable User ID used in the Driver Contract page. Build the markup for the administrator's link to the Driver Contract page with the proper URL parameter, based on the User in the list loop, something like this:
<wpv-loop> ... <a href="http://yoursite.com/contract/?user_id=[wpv-user field='ID']">view</a> ... </wpv-loop>
In the content of the contract page, you can access that user ID using the shortcode wpv-search-term:
[wpv-search-term param='user_id']
You can pass that value into your template's User shortcodes:
[types usermeta="contract-number" user_id="[wpv-search-term param='user_id']"][/types]
Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Dieses Thema enthält 3 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von vor 6 Jahren, 11 Monaten.
Assistiert von: Christian Cox.