Skip Navigation

[Resolved] wpv-if does not seem to be working even updating to Views beta3

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.

Tagged: 

This topic contains 4 replies, has 3 voices.

Last updated by Kristin 6 years, 1 month ago.

Assigned support staff: Luo Yang.

Author
Posts
#321018

Hi there, I have this code for one of my loops:

[wpv-layout-start]
[wpv-items-found]
<div class="view-archive people-archive
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'list' or wpv_view_shortcode_attribute('format') = 'list-with-courses'"]list-archive[/wpv-if] list-[wpv_view_shortcode_attribute att="format"]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') != 'list' and wpv_view_shortcode_attribute('format') != 'list-with-course'"]is-archive[/wpv-if]">
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'list'"]
<div class="person">[wpv-post-body view_template="Person - Archive (List)"]</div>
[/wpv-if]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'list-with-courses' and wpv_has_courses() = 1"]
<div class="person">[wpv-post-body view_template="Person - Archive (List)"]</div>
[/wpv-if]

[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'contact'"]
<div class="person entry [has_thumbnail]">[wpv-post-body view_template="Person - Archive (Contact)"]</div>
[/wpv-if]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'trustee'"]
<div class="person entry [has_thumbnail]">[wpv-post-body view_template="Person - Archive (Trustee)"]</div>
[/wpv-if]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'intern'"]
<div class="person entry [has_thumbnail]">[wpv-post-body view_template="Person - Archive (Intern)"]</div>
[/wpv-if]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'faculty'"]
<div class="person entry">[wpv-post-body view_template="Person - Archive (Faculty)"]</div>
[/wpv-if]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = 'faculty-with-courses' and wpv_has_courses() = 1"]
<div class="person entry">[wpv-post-body view_template="Person - Archive (Faculty)"]</div>
[/wpv-if]
[wpv-if evaluate="wpv_view_shortcode_attribute('format') = ''"]
<div class="person entry [has_thumbnail]">[wpv-post-body view_template="Person - Archive (Contact)"]</div>
[/wpv-if]
[wpv-if]
</wpv-loop>
<!-- wpv-loop-end -->
</div>
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]Coming soon. . .[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

--
And this is what I got on the fron-end of our staging server, running Views 1.9b3: hidden link
here is the link: hidden link

That same page/code is working correcly on our live site (running Types 1.6.1) even after the new WordPress security release:
hidden link

It seems that the new beta version fixed a lot of issues but broke some of the pages that were not affected by the WP security update.

Is there anything that I could do in my code in order to have it working properly with the new beta3 version? I tried changing the double quotes to single quotes but I had no luck.
Any direction to get solved would be much appreciated, thanks!

--

#321124

bruce
Supporter

Languages: English (English )

Timezone: Australia/Perth (GMT+08:00)

Hi Kristin,

I tried to reproduce this, but it works fine when I test custom functions in wpv-if shortcodes. We've made significant changes in this area to support WP 4.2.3 and we may have missed some special cases.

Would you be able to provide us with a duplicator dump to help us debug this. You can use the duplicator plugin to create a duplicate of your site that we can then download and use for debugging.

https://wordpress.org/plugins/duplicator/

I'll make the next message private so you can add some details if you are able to.

Best regards,
Bruce

#321176

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Kristin,

Our developer has already into this thread, I will follow it too, please let me know if you need more assistance for it. thanks

#321578

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, I have modified below in your website:
Dashboard-> Views-> Settings-> Compatibility,
In option "Functions inside conditional evaluations", add the function name in it "wpv_view_shortcode_attribute",

More help:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/#using-custom-functions
Before using a function inside a conditional, you need to register it for security reasons. Even WordPress functions need to be registered. To do so, visit the Views -> Settings page and simply add your function to the section Functions inside conditional evaluations:

please test again, check if the problem is fixed or not, thanks

#321797

Hi Luoy, thanks for you help! Everything seems to be working correctly now.