Hi I'd like to insert shortcode to display a content-template in a tab section of a page.
Is this possible? If so can you show an example. I'm using classic editor not blocks.
Thanks
Hi, you can insert an arbitrary Content Template in a classic editor design using the wpv-post-body shortcode. We have documentation available in programmer information here: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body
An example showing how to place a Content Template with the slug books-template:
[wpv-post-body view_template="books-template"]
Let me know if you have additional questions about that.
Hi Christian,
Thanks for your quick response, think I'm missing something 'cause the tabs I created with tabs responsive plugin isn't showing.
I see the content-template displayed as a page not in a tab.
I'm told:
Use below shortcode in any Page/Post to publish your Tabs
[TABS_R id=19319]
I want to use the tabs in a custom post type, so where exactly should I place the above shortcode so that the tabs appear in all posts of that type? (I tried placing it in a specific post but didn't have any effect - no tabs displayed)
Is there a tabs plugin that you recommend for toolset?
Thanks
I want to use the tabs in a custom post type, so where exactly should I place the above shortcode so that the tabs appear in all posts of that type?
If you want to show those 3rd-party tabs on every post in the custom post type, you probably need to insert their shortcode inside a Content Template that is applied to the entire post type (i.e. applied to all the posts in that post type). Then if you want to display a different Content Template inside one of those tabbed panels, you can insert that other Content Template shortcode inside the tab panel contents following the instructions from the 3rd-party plugin's tabs documentation - I'm not sure how this one works offhand. Just be careful you don't accidentally nest the same Content Template shortcode inside the tabs, inside itself, which would create an infinite loop and potentially crash the site. You must use at least two different Content Templates here - one applied to the posts, which will display the tabs, and a second Content Template inserted in the tab panel contents using the shortcode, which will display in that tabbed panel whatever you include in the second Content Template.
Is there a tabs plugin that you recommend for toolset?
In the Block Editor, the free Kadence Blocks plugin includes a tabs block that is pretty simple to use. Since Toolset offers to include the Bootstrap library (Toolset > Settings > General tab), you could use Bootstrap navs (with Bootstrap 4) in a code-based solution outside of the Block Editor: https://getbootstrap.com/docs/4.5/components/navs/#javascript-behavior
Unfortunately I don't have a shortcode-based plugin recommendation. None are integrated with Toolset in any meaningful way, that I'm aware of.
Hi Christian, Yeh I got the infinite loop.
If I understand to display the main content template in a tab I need to create a second content template like so:
[TABS_R id=19319]
[wpv-post-body view_template="the main content template"]
Is that correct?
If I understand to display the main content template in a tab I need to create a second content template like so:
That's how you would display a different Content Template, yes, but to create the template you must go to Toolset > Content Templates first and create the template. Instead of assigning that new Content Template to a post type or an individual post when you create the template, leave it unassigned.
Let's assume you already have one Content Template created called "Post Type Template" and it is applied to all the posts in the post type where you want to display the tabs. This template includes the tab shortcode you mentioned before, so it will display the tabs in every post where this template is assigned. Next, you would create a new Content Template in Toolset > Content Templates - let's assume you call it "Template to show in Tab". Add whatever content you want to display in the tab. For testing, I suggest you just add some simple text, then replace it later once you confirm the simple text is displaying correctly in the tab.
You would then edit the "Post Type Template" Content Template and place the "Template to show in Tab" Content Template inside it somewhere using a wpv-post-body shortcode like so:
[wpv-post-body view_template="Template to show in Tab"]
Where you place this shortcode in the Post Type Template code depends on how your tab system shortcodes work. That plugin's support team or documentation would be better sources of information about that shortcode formatting and structure.
Hi Christian, Thanks very much for the detailed explanation of how to add tabs.
Decided not to go this route, as doesn't seem to blend well with toolset, and I don't have the time to work on it.
Instead put all the sections on the one page and used anchor bookmark pairs to jump to each section - works well.
Thanks for you help
David