Skip Navigation

[Resolved] View inside conditional block not rendering

This thread is resolved. Here is a description of the problem and solution.

Problem:

Setup conditional block using URL parameter.

Solution:

You can use Toolset conditional blocks with below conditions:

empty('[wpv-search-term param="mto"]')

NOT (empty('[wpv-search-term param="mto"]'))

Relevant Documentation:

This support ticket is created 4 years, 7 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
- 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 4 replies, has 2 voices.

Last updated by RensV5812 4 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1605391
Toolset: view in conditional.png
Screenshot 2020-04-29 at 11.14.56.png
Screenshot 2020-04-29 at 10.52.32.png

Hi guys,

I've customized the Toolset Messaging module to display all relevant information in one page. Check out this support ticket where I've described how it's set up in more detail:
https://toolset.com/forums/topic/customizing-the-toolset-messaging-module/

The issue is that when the page is opened initially, the views that rely on url parameters to show the correct information (like contact, initial post name, post author) already display information even though no 'conversation' has been selected yet. I figured I would get around this by placing these views inside a conditional block that checks whether url parameter 'mto' is empty or not. This works. However, the views inside the conditional block don't render.

I've attached some screenshots that should help understand what I mean. One shows the backend with view 1 and view 2 inside a conditional block and one the frontend with the view not rendered. The last one shows a description of all views and shows what it should look like when working (except for the dark grey areas of course).

So the question is, how do I get views to render inside a conditional block? Is this even possible? If not, do you know of a workaround?

If anything is not clear please let me know.

Thanks again,
Rens

#1606657
add-block.JPG

Hello,

Yes, it is possible to render inside a conditional block, for example, you can edit the "Inbox" page:
hidden link
find the conditional block, click button "Add Block", see screenshot: add-block.jpg
Toolset-> View, here you can choose those existed view block or create new view block.

#1606669

Thanks Luo,

When I tried to drag the view into the conditional block the results didn't show anymore, just getting the shortcode for the view (see the third image).

Rens

#1606703

Thanks for the details, I can see the problem in your website.

But I don't reproduce the same problem in my localhost with a fresh WordPress installation, then I tried it in your website by these:
1) Create a new fresh page:
hidden link

2) Setup two Toolset conditional blocks with below conditions:
empty('[wpv-search-term param="mto"]')

NOT (empty('[wpv-search-term param="mto"]'))

Put different post views into above conditional blocks.

Test it in front-end, it works fine:
hidden link
hidden link

So it might be an exception of your website, please try to create a new page, and setup the conditional blocks, and test again.

#1610679

You're right, I created a new page, literally copied everythingbut now it works. :/

My issue is resolved now. Thank you!