Skip Navigation

[Gelöst] Conditional Statement is not working

This support ticket is created vor 8 Jahre, 5 Monate. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 5 Antworten, has 4 Stimmen.

Last updated by antonyW-2 vor 8 Jahre, 5 Monate.

Assisted by: Beda.

Author
Artikel
#340630

I am trying to:
Add conditional statements in a view but it´s not getting parsed.

I tried to do it with your example conditional statement:

[wpv–conditional if="('1' eq '1')"]This is some text[/wpv–conditional]

Same thing.

For testing I used the old if-logic and this seems to work.
Do I need to activate something to make the conditional statements running too?

Many thanks!!!
Manuel

#340669

Thank you for contacting us here in the Support Forum

Could you let me know what exactly you want to evaluate?

Evaluating if 1=1 is probably not your goal, but of course I understand that you want to compare some given value with a value you check with.
(our example is just to give a idea of the syntax)

What you want to evaluate and compare with which value?

As example, this below outputs on my end the Post Title only if the Post in Loop ID is 46:

[wpv-conditional if="( '[wpv-post-id]' eq '46' )"][wpv-post-link][/wpv-conditional]

This one outputs (of course) all results:

[wpv-conditional if="( '1' eq '1' )"][wpv-post-link][/wpv-conditional]

What I have noticed is that our DOC uses a wrong "-" in the wpv-conditional and that's probably because your code doesn't work.
(if copied directly form the DOC)

See below:
DOC:

[wpv–conditional if="('1' eq '1')"]This is some text[/wpv–conditional]

CORRECT:

[wpv-conditional if="( '1' eq '1' )"][wpv-post-link][/wpv-conditional]

(The line "-" is in DOC a wrong "–")

I have reported this so our DOC team can fix this wrong syntax immediately.

Please let me know if you need further infos about this.

Thank you for your patience.

#340670

I deeply apologize as this seems even worse.

It is a bug in the Code Rendering System as you can see in my above reply.

The correct is to use "-" in your wpv-if or wpv-conditional.

If I put this in a code HTML tag in the forum here the "-" becomes "–" and that is wrong.

I apologize and will ask our Team to fix this ASAP.

Thank you for your patience.

#340698

Hey Beda!

thanks for your help!

No worries at all!
I replaced the "–" and now it work´s perfect! 🙂

Bye,
Manuel

#344075

in my case in a Content-Template in Views it does not work (and the produkt is in term-id 11 bzw. wpv-taxonomy-id 11 ):

[wpv-conditional if="( '[wpv-taxonomy-id]' eq '11' )"] testtext [/wpv-conditional]

this does not work also (and i fill in taxonomy-description 'johndeere'):

[wpv-conditional if="( '[wpv-taxonomy-description]' eq 'johndeere' )"]test[/wpv-conditional]

what is wrong

thanks - alex

#354950

Has this issue been fixed yet, because no matter what I type I still get "–" and not "-" . Very frustrating......

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