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
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.
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,
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.
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.