Skip Navigation

[Closed] Problem when i want to print a custom field value in a conditional block

This support ticket is created 3 years, 9 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by Minesh 3 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2202125

I am trying to:
Output data value in conditional blocks
----------Code
[wpv-conditional if="( $(wpcf-tipo-di-data) eq '1') AND ($(wpcf-data-inizio-evento) ne '')"]
<p id="sch11">Data: [types field='data-inizio-evento' format="d/m/Y"][/types]</p>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-tipo-di-data) eq '2' ) AND ( $(wpcf-data-inizio-evento) ne '') AND ( $(wpcf-data-fine-evento) ne '' )"]
<p id="sch11">Data inizio:[types field='data-inizio-evento' format="d/m/Y"][/types]</p>
<p id="sch111">Data fine:[types field='data-fine-evento' format="d/m/Y"][/types]</p>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-tipo-di-data) eq '3') AND ($(wpcf-data-ripetibile) ne '' )"]
<p id="sch1">Date:</br>[types field='data-ripetibile' format="d/m/Y G:i " separator='</br>'][/types]</p>
[/wpv-conditional]

Link to a page where the issue can be seen:

I expected to see:
e.g:
if tipo-di-data==2 AND data-inizio-evento =! "" AND data-fine-evento =! ""
PRINT:
Data inizio: 13/09/21
Data fine: 16/09/21

Instead, I got in my front-end page:
Data inizio:[types field='data-inizio-evento' format="d/m/Y"][/types]
Data fine:[types field='data-fine-evento' format="d/m/Y"][/types]

#2202345

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Do the types shortcodes work if you move them outside of the conditional shortcodes?

The Types plugin is active, yes?

I suspect we may need access to your site to investigate, as it is not something we would be able to replicate.

Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.

Can you also confirm the url of where we can see the problem.

#2202421

I sent you private info about the problem, Pls confirm that you have received infos because i don't see anything that confirm it.
Tnx

#2202689

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

When using the Toggle module it does not able to parse the Toolset shortcode, so what I've done is, I've created the following content template and added all the code you added to "toogle module" to this content template:
=> hidden link

And then within your toggle module, I've added the above content template as given under:

[wpv-post-body view_template="toggle-content-template"]

Can you please confirm it works as expected now.

#2203241

Hello there!
It seems to work but with conflicts. For example in this post hidden link if you're logged as admin it works, but if you're not logged in it doesn't work. This is weird, because with other posts toolset works well.
I thought it was a cache problem, so I added this cose string in functions.php: add_filter( 'wpv_filter_disable_caching', '__return_true' ); //reflush cache view; but it's not enough.
I compared it with another post with the same structure (hidden link), but they look alike.
Thank you

#2204695

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

What you mean by if I'm not logged-in it does not work.

I can see the following when I visit the page when as guest user:
- hidden link

Can you please tell me what is your expected output as logged-in and non-logged-in user?

The topic ‘[Closed] Problem when i want to print a custom field value in a conditional block’ is closed to new replies.