I created a job portal. On th apply button I created a dynamic link to send parameters to the form:
hidden link field='e-mail-adresse' output='raw' item='@ansprechpartner-stelle.parent' ][/types]&rtitle=[wpv-post-title output=" sanitize"]&rklinik=[wpv-post-taxonomy type="standort" format="name"]&rstelle=[types field='vertragsart'][/types]
All of the parameters work except the wpv-post-taxonomy type="standort" format="name"
It is empty. When entering this shortcode in the form it shows the correct information, only in the link its empty. I tried dozens of variations without sucess.
Do I make a syntax mistake?
The site where you can find the link is hidden link
Do I make a syntax mistake?
Hello, I do not see anything obviously wrong in the wpv-post-taxonomy shortcode. Can you show me how you are adding this link in the template? Is the code added to the URL field of a Button block, or have you created a custom link tag using HTML somehow? A screenshot of the template editor would be helpful for me.
Next, try inserting the following code in a custom HTML block in your template to troubleshoot the taxonomy shortcode issue a bit more:
Name format:<br />
[wpv-post-taxonomy type="standort" format="name"]<br />
Name format with separator:<br />
[wpv-post-taxonomy type="standort" format="name" separator=", "]<br />
Slug format:<br />
[wpv-post-taxonomy type="standort" format="slug"]<br />
Please take a screenshot of the results and include that in your next reply.
Yes, I added the code to the URL field of the Button block - see Screenshot
I also added the results of the HTML code.
Okay thanks for the test code. It seems that the wpv-post-taxonomy shortcode is working as expected in the test based on the screenshot you shared. As far as I know, the "link" field in the Toolset Button block is not intended to support shortcodes. However, in my local tests, I was able to get them to work...unexpectedly. The format in my local test is a bit different from yours. My format includes only single quotation marks, no double quotation marks. I also removed the space in the 'sanitize' output attribute, and added output='raw' in all Types field shortcodes. Here is the updated format:
https://yourseite.de/bewerbungsformular?rmail=[types field='e-mail-adresse' output='raw' item='@ansprechpartner-stelle.parent' ][/types]&rtitle=[wpv-post-title output='sanitize']&rklinik=[wpv-post-taxonomy type='standort' format='name']&rstelle=[types field='vertragsart' output='raw'][/types]
If I paste similar code into a Button block's "link" fields, this syntax seems to work in my local test site...even though I would not expect it to work. My example uses different custom field slugs and a differerent taxonomy slug, but the general idea is the same.
I usually recommend creating a custom link instead, to prevent problems with shortcode interpretation in the block editor. So if the Button block is not working as expected in your site after placing the code above in the Button block's "link" field, I suggest you create a custom link instead using a combination of HTML and shortcodes in a custom HTML block, something like this:
<div class="tb-button">
<a href="https://yourseite.de/bewerbungsformular?rmail=[types field='e-mail-adresse' output='raw' item='@ansprechpartner-stelle.parent' ][/types]&rtitle=[wpv-post-title output='sanitize']&rklinik=[wpv-post-taxonomy type='standort' format='name']&rstelle=[types field='vertragsart' output='raw'][/types]" class="tb-button__link">
<span class="tb-button__content">Bewerben</span>
</a>
</div>
Then add CSS in the template to apply the desired background and text color to the button, like this:
.tb-button .tb-button__link {
background-color: rgba( 6, 147, 227, 1 );
color: rgba( 255, 255, 255, 1 );
}
Thanks Christian, as everytime, your help was perfect and solved my issue.
My issue is resolved now. Thank you!
Sorry Christian,
but there is still a issue. In my tests all is working well. But when visitors use the link in most times all the parameters are empty. I'm not sure why. Could it be, if a visitor is pressing the button fast, that Toolset is not ready getting the data?
I already deactivated the site where the button is in WPRocket to be sure not to have a cache issue.
Thanks
Alex
Could it be, if a visitor is pressing the button fast, that Toolset is not ready getting the data?
No, that is a reasonable guess, but it is actually not possible here because the link HTML is constructed on the server-side before the View results are sent to the browser. The only way what you described would be possible is if the button's HTML and the Types field shortcode values were sent as different pieces of data, and combined somehow later with JavaScript. That is not the case here, the link markup is already complete when it is sent from the server. Even if a View's results are fetched with AJAX, the results for a single "page" of the View are fetched as a single data set, fully rendered in HTML by the server.
Something else is going on. Perhaps Visitors have access to another link somewhere, and that link includes no URL params. Or they could be visiting the page by typing the URL directly in the browser with no URL params.
I cannot reopen this ticket now, but I see you have another ticket created:
https://toolset.com/forums/topic/regarding-my-last-ticket-i-have-an-additional-issue-taxonomy-as-url-parameter/
I will be unavailable for the next 10 days so I will not be able to follow up here in a reasonable amount of time. I suggest you continue in the new ticket with Luo.