Skip Navigation

[Resuelto] Show the shortcodes array with PHP

This support ticket is created hace 6 años, 5 meses. There's a good chance that you are reading advice that it now obsolete.

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 3 respuestas, has 2 mensajes.

Last updated by Luo Yang hace 6 años, 5 meses.

Assisted by: Luo Yang.

Autor
Mensajes
#589909

Hi Luo, i opened this extra ticket to spread the different questions on the same topic.

Concerning your reply #589663 :

I'd need to show that value via PHP on pages such as 'checkout'. I tried with a simple echo do shortcode but that didnt work out.
The shortcodes in question are:
[wpv-post-body view_template="show-the-label-values" id="[wpv-user field="wpcf-billing-addresses-nl"]"]
[wpv-post-body view_template="show-the-label-values" id="[wpv-user field="wpcf-billing-addresses-fr"]"]
and so on.
As you may know, there are about 15 of these (1 per region) and only 1 will show a value. So we should maybe need 'hide' the results from the other 14 shortcodes, to come to a simple clean line with 1 result.
How would that work??

PS i have a custom checkout temlate located in child theme/woocommerce/checkout/.. and line 39 is where i put that simple echo.

And: will this work (show result) on the woocommerce emails if i include the code in the mail templates?

Thanks and kind regards

#590095

Dear filip,

Q1) So we should maybe need 'hide' the results from the other 14 shortcodes, to come to a simple clean line with 1 result.
You can put all the shortcode you mentioned above into another content template, for example content template "all-in-one":

[wpv-post-body view_template="show-the-label-values" id="[wpv-user field="wpcf-billing-addresses-nl"]"]
[wpv-post-body view_template="show-the-label-values" id="[wpv-user field="wpcf-billing-addresses-fr"]"]
...

Then display them with only one shortcode of content template "all-in-one", for example:
[wpv-post-body view_template="all-in-one"]

You can display the content template "all-in-one" in your theme file with Views PHP function "render_view_template", for example, the ID of content template "all-in-one" is 123, then you can use below PHP codes:

echo render_view_template('123');

See our document:
https://toolset.com/documentation/programmer-reference/views-api/#render_view_template
render_view_template
Returns the content of a Content Template applied to a post.

Q2) will this work (show result) on the woocommerce emails if i include the code in the mail templates?
That depends on how do you setup the woocommerce emails, you can test it and start a new thread if there is any problem

#590335

Dear Luo, thanks! For external reasons I'll be picking this up again only after the weekend.

#590413

OK, please update this thread when you need more assistance. thanks

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.