Skip Navigation

[Resolved] Is it possible to string views together.

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by carlosB-2 7 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#563766

I'm not sure if this is something that's possible to do.... and if there are any suggestions on a different way to accomplish this, I would love the input.

I'm trying to use a view to generate a <table> that is pulling information from three different CPTs (workshops, showcases and one-acts). All three of those CPTs are also the parent CPT to a fourth CPT, schedules. I'm using Schedules to determine the overall order of the content in this table.

The view is displaying Schedule posts

(I have another support ticket open trying to get the sort order working, because it's based on two custom post fields).

So the question I have here is whether it's possible to string together several views. I have created separate views for each of the workshops, showcases and one-acts, and the wpv-loop includes a content templates that generates the properly structured <tr> for each different type of post.

I'm close to what I'm trying to achieve, but the problem I'm running up against is that each view wraps the output in a <div id="wpv-view-layout-xxx"> and since those divs are in the middle of a table, it's breaking my table.

I found a function here: https://toolset.com/forums/topic/how-can-i-suppress-the-wpv-view-layout-divs-in-my-views-results/

but that removes everything outside of the <wpv-loop> and that's not what I'm wanting to do... I just need to eliminate the <div id="wpv-view-layout-xxx">s that wrap the view content.

But if there's a different technique that would work to string together content from various CPTs, I would love to try it.

Is there a similar example that we can see?
This is a hard-coded version of what I'm trying to achieve: hidden link

What is the link to your site?
This is the page where I'm working on this view
hidden link

#563805

You can adapt that function to exclude less.

The problem is that this DIV is needed for several features in Views.
Now, if you want to remove it, this is the only way to do it.

If you remove that DIV, you get only what is in the loop, a raw output.

As you see, you can modify the key searched by in that code. It uses right now <!-- wpv-loop-start --> and <!-- wpv-loop-end -->

But I cannot recommend either the usage of that code, nor of a modified one, to be honest, it can break many features in views, and the plugin is not built to provide data, but to display it.

If you want to put different Views results inline, you need to apply that Custom Code thou, there is no other method.

#563908

Hi Beda - Thank you for the reply...

I'm not good enough with PHP to be able to modify that code since to strip the <div id="wpv-view-layout-xxx"> and the closing </div> tag that are output around each view.

Is that something you can help me with? I understand the reasons they need to be there, but I figured I could ask.

If that's not possible to do, I think I'll have to go with another idea which is to create separate views
with a full <table> for each Session in this conference and use the [wpv-view] shortcodes one right after the other on the page where I need to display this master schedule. A little bit harder to maintain, but it might be my only solution.

Thanks,

#564667

What you can do is put all things you still want in the output after and before the <!-- wpv-loop-start --> and <!-- wpv-loop-end -->

So when you strip all around it, you still get your wished content.

It is the only chance to strip that default HTML away, and if you need things outside the Loop, but within the returned output, you will need to put it right between the <!-- wpv-loop-start --> and <!-- wpv-loop-end --> HTML tags.

Otherwise it will be stripped as well.

#564855

Thanks, Beda. I understand what you're saying.

I ended up going with my other idea, which is to create separate views for each section that I needed, and just displaying a series of [wpv-view] shortcodes on the page where I needed this schedule.