Skip Navigation

[Resolved] Display Tabs with custom taxonomy and child cpt on parent post

This support ticket is created 6 years, 9 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#669548

Tell us what you are trying to do?

I have a parent cpt called 'games', a child cpt called 'guides' that has a custom taxonomy called 'guide-category'.

What I want is to display tabs on the 'games' cpt using the custom taxonomy as tab title, and in the tab content a list of post which belongs to that category.

Of course, I want the tabs to visible only if there is some 'guides' in that 'guide-category'.

Is there any documentation that you are following?

I followed this post from the support forum https://toolset.com/forums/topic/creating-a-conditional-view-based-on-child-cpt/
and I created all as explained, adding to the third view a new Post relationship filter: Select posts that are children of the current post in the loop.

Everything works, but the problem lies in the fact that it shows me all the tabs categories even the empty ones, while as mentioned above I would like to show only those that actually have posts.

What is the link to your site?
I was trying this on a local site.

I have also a question that does not concern your plugins, but your forum and is why all the links in the posts are hidden with the hidden link label?
Sometimes it is difficult to understand what documentation or resources are linked.

One last thing, maybe it's a bug, but I'm using the Sharing buttons shortcode for Jetpack plugin and inserting the shortcode in a Visual Editor cell of any Layout template on the frontend nothing it's shown.
I can see the sharing buttons only by inserting the shortcode into a view which then I add to the Layout template.

#671102

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Alessandro

To know whether to display the tab using some kind of conditional test would imply running the identical query for the child posts within the tab twice, which is hardly efficient.

I think a smart-CSS solution might be the best option here.

Your tabs would need something to target them with CSS, either an ID generated from the category or a unique classname generated from the category, such as tab-cat-a, tab-cat-b, tab-cat-c etc.

Then in your View to display the child posts, in the "No items found" section of the Loop Output, replace the no-items text with style tags that include a CSS rule to not display the parent tab using the same unique classname or ID that you generate using the taxonomy slug.

Does that make sense? I would need examples of your categories and how you have set up the tabs etc. to give you an explicit demo, but hopefully you understand the concept.

Regarding the hidden links, this was introduced in response to clients who were unhappy that the links they posted to their sites were visible to the public, and so now only links to certain white-listed sites such as stackoverflow or the WordPress documentation pages can be seen by users other than the original poster and supporters.

Our support policy requires handling separate issues in separate threads, and I'll need to ask you to open the Jetpack issue in its own thread, I'm afraid. You could try adding it to a Content Template instead of a View and inserting a Content Template cell in the Layout, but it would be expected that adding it directly to a Visual Editor cell should work.