Skip Navigation

[Resolved] Conditional output not working in Divi 4.0.6 – Theme builder post body template

This support ticket is created 4 years, 12 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by philippeS-4 4 years, 12 months ago.

Assisted by: Nigel.

Author
Posts
#1386577

Hi,

I am using Divi 4.0.6 and I saw that most of Toolset issues were resolved in a previous version and I got the following issue, before I contact Divi support I just wanted to run by you the following issue I am experiencing.

In the Theme builder I am building a template for single post "All Articles". It is working fine and I can display the content of the fields properly. I have a url field called "article-source" were the content is being displayed properly but I would like to test if the field is not equal to blank and then displaying with some specific content. For some reason the test is no working.

Could you check that my string is correct and if you have any idea on how to make it work, unless it is really a Divi issue.
Appreciate your help.

[wpv-post-body view_template="None"]

[types field='article-source'][/types]

[wpv-conditional if="( $(wpcf-article-source) ne '' )"]
     [types field='article-source' title='Source' target='_blank'][/types]
[/wpv-conditional]

I have just added the field "article-source" to make sure the content is being displayed which it is.

Link of a post with the field "article-source" filled in.
hidden link

#1386653

Nigel
Supporter

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

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

Hi Philippe

This is a known issue (though we haven't published an erratum about it yet, sorry), and the problem appears to lie with the global $post object being manipulated in Divi's Theme Builder and not pointing to the current post.

We have contacted Divi with all the details and hopefully they will be able to fix.

It may expedite things if you contact their support so that they know there is demand from their customers to resolve the problem.

#1386739

I have contacted DIVI support team, let see what happens! My issue is resolved now. Thank you!

#1388543

Nigel
Supporter

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

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

A quick follow-up to say that my colleague proposes you add the attribute id='$current_page' to your conditional shortcodes to override the post ID and you may find that works.

{!{wpv-conditional if="( $(wpcf-article-source) ne '' )" id="$current_page"}!}
     [types field='article-source' title='Source' target='_blank'][/types]
{!{/wpv-conditional}!}

If you try let me know, thanks.

#1388551

Hi Nigel,
Thanks for the follow-up although your code didn't work it put me in the right direction.

[wpv-conditional if="( $(wpcf-article-source).item($current_page) ne '' )"]
[types field='article-source' title='Source' target='_blank'][/types]
[/wpv-conditional]

This is working fine!
Great support.