I am trying to:
I have the scenario where I have players who can be assigned to more than one team, so I have a custom field called Team ID that is set to be a repeating field. For each team the player gets assigned to, the team id is added to their post. However, when I select the team and get the list of players for that team, I need to be able to view the player's profile so I can manage their assignment to the team(s) their assigned to.
However, when I try and pass the current team ID via the URL, because the player has multiple team IDs, all of them show up in the URL, which causes a bunch of stuff to break. H
Link to a page where the issue can be seen:
hidden link
I expected to see:
I was hoping I would be able to maintain the single team id that I had been viewing. You can see the multiple team id's in the url at the bottom of the screenshot. However, just below the game title, you can see the Team ID i'm currently viewing. I only want to pass that value, not all team ID's in the player's post.
Instead, I got:
Just pass the Current page/posts' ID to the HTML where you generate the "manage" button's URL
In the View with ID 319 you added the HTML for the Button with class "button small orange" in a "col-md-3" DIV.
I assume you used ShortCodes to build the dynamic link.
You could just remove that ShortCode of the repeating field, as all you want here is the actual ID of the current team, which in the best case would be the current page.
So you could insert a ShortCode like wpv-post-id item="$current_page" in there.
This would ensure to take the ID of the current page (current team in this case) and plot it into the Button's Link, just as now you plot the repeating field, but it'll pass only (the needed) one ID of the team.
https://toolset.com/documentation/user-guides/views/views-shortcodes/item-attribute/
However that's not the case, you only know the Team ID from the URL parameter of the current View.
So you'd have to work with the wpv-search-term ShortCode.
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-search-term
For example, you can render the ID of the Team being viewed (knowing its URL parameter) by:
[wpv-search-term param="tid"]
This would show only the value of the URL parameter "tid", no matter where you insert this ShortCode.
Now this time, if you insert this in the HTML to build the button's URL, if clicking on it, you'd pass only that Team ID to the URL.
Is that resolving the issue?
This solved my issue, thank you!