Skip Navigation

[Resolved] Hiding tabs when empty

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

Problem: I would like to hide a tab when its tab panel contents are empty.

Solution: There's no way to apply conditional logic to a Layouts tab cell like this, but if you know how to create tabs using CSS / HTML / JavaScript you may be able to implement conditional HTML around each tab and tab panel.

Relevant Documentation:
https://getbootstrap.com/docs/3.3/javascript/#tabs
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This support ticket is created 6 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by MerleV713 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1156518

Tell us what you are trying to do? Dear I was wondering how to create tabs with a conditional logic. So when the tabs content is empty the tab will not being displayed in the layout

#1157325

Hi, there's nothing built-in to Toolset Layouts that will help you create conditional tabs and tab panels. I think you would need to use custom JavaScript code to manipulate tabs dynamically when the page loads. Layouts tab cells operate on the Bootstrap 3 system, so you can find code samples and documentation on the Bootstrap site: https://getbootstrap.com/docs/3.3/javascript/#tabs

If you'd like to see conditional tab features added to the software, I encourage you to submit a new ticket in the forum using the "Suggest an improvement" option. This will put your request in front of our developers, who will decide if it's something we can implement in a future release.

#1169671

Dear Christian,

Thanks, that is a pitty.. because I asked this before I bought toolset and then i became this answer:
Toolset can help you create conditional output (kind of if-else statements but based on shortcodes) so as soon as you know to create such tabs in CSS/HTML, it seems doable.
I will look up your advice, thanks!

Best regards Merle