[Resolved] How to create a view with different post types
This thread is resolved. Here is a description of the problem and solution.
Problem:
The issue here is that the user has a view that lists multiple post types but want to style each post type differently
Solution:
Here is how I achieved this:
Create your view and ensure that you've selected the option "Allow multiple Post types".
Select the post types that you want to be included in the view.
Ensure that you've set the sorting option on the view. See Screenshot. You will need to do this so the posts types are listed together.
On the view loop section you will add a conditional block for your first Post Type. Setup your conditionals as per my conditional screenshot, where you will select the Post Source, in a case of a multiple post type view you can leave this unchanged as it will set the correct information once the view is displayed. However for the source you will select Post Type, then the comparison is done for a static value and just add the post type slug.
In that conditional block you will setup how you want your post type A to display.
Using the block navigator tool. Select the view loop and then add a new conditional block to that loop and repeat steps 4 and 5.
When you are finished you can double check your structure and ensure that all your conditional blocks are within the view loop
100% of people find this useful.
This support ticket is created 4 years, 3 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.
I'm trying to create a page with a map and filter that is related to three post types I have created. I want to style the post types differently in the view, but still have all of them using the same filter/map on one page. Is this possible with toolset and the view function? I've added a sketch of what I'm trying to accomplish.
Thank you for getting in touch. Yes this is possible to do. Here is my basic test, see screenshot
From the screenshot you see that I have 2 post types, Venue and Speaker. You will notice that Venue and Speaker both uses different font colors.
Here is how I achieved this:
1. Create your view and ensure that you've selected the option "Allow multiple Post types".
2. Select the post types that you want to be included in the view.
3. Ensure that you've set the sorting option on the view. See Screenshot. You will need to do this so the posts types are listed together.
4. On the view loop section you will add a conditional block for your first Post Type. Setup your conditionals as per my conditional screenshot, where you will select the Post Source, in a case of a multiple post type view you can leave this unchanged as it will set the correct information once the view is displayed. However for the source you will select Post Type, then the comparison is done for a static value and just add the post type slug.
5. In that conditional block you will setup how you want your post type A to display.
6. Using the block navigator tool. Select the view loop and then add a new conditional block to that loop and repeat steps 4 and 5.
7. When you are finished you can double check your structure and ensure that all your conditional blocks are within the view loop. See my screenshot for an example of what it should look like.
Please let me know if this helps or if further clarification is needed.
Thank you for your help. It is great that this is possible to achieve
For some reason this worked with my group 2 and group 3, but not my group 1. The page display nothing from group 1.
Group 1 have post type: avenger - hidden link
And in the conditional settings I've set up the static value to equal avenger.
Any ideas why this might not work for this spesific post type? You can see my test page here hidden link
My issue is resolved now. Thank you! Sorry, realised I had set a custom URL format on that post type. Needed to input that in the conditional static value and not the post type.