Skip Navigation

[Resolved] Set conditions for the layout in real Estate demo

This support ticket is created 5 years, 6 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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by nabils 5 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1280649

Tell us what you are trying to do?

I am using Real Estate demo. I Created a layout for property details. In the layout there is three tabs first one contains the content template for property. The second one contains rentals view. I want to set condition in the layout such that it can be displayed for a specific user role. In this case only the post owner can see the rentals tab.

#1280925

Hi there,

Thank you for contacting us and I'll be happy to assist.

The "Tabs" widget in the Layouts plugin doesn't support this conditional control feature, out-of-the-box, but you can follow this workaround:

1. In your Rental tab's settings, please include a custom class e.g. "rental-tab", as shown in these screenshots:
Screenshot A: hidden link
Screenshot B: hidden link

2. Next, at the bottom of that layout, include a new "Single Widget" and select a "Custom HTML" type widget.
Screenshot: hidden link

3. In the content of this new widget, you can include some Custom CSS code, which conditionally works to show the rental tab, if the current user is also the author of the current post and if not, hide it:
Screenshot: hidden link


[wpv-conditional if="( '[wpv-post-author format="meta" meta="ID"]' eq '[wpv-user field="ID"]' )"]
<style type="text/css">.nav.nav-tabs .rental-tab { display: block !important; }</style>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-author format="meta" meta="ID"]' ne '[wpv-user field="ID"]' )"]
<style type="text/css">.nav.nav-tabs .rental-tab { display: none !important; }</style>
[/wpv-conditional]

You can learn more about how output works in Toolset from this guide:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

I hope this helps and please let me know how it goes.

regards,
Waqar

#1281251

My issue is resolved now. Thank you!