Tell us what you are trying to do? I have two custom post types: a Student Project and Student Thesis. I'd like to create a view that displays a grid / index of all Student Project and Student Thesis posts. I understand how to create a single indexical listing of just one post type, but two is out of my grasp. In mathematical terms, I am trying to create a combined listing with the union of both post types, and order them based on a shared field.
Is there any documentation that you are following? No.
Is there a similar example that we can see? Please refer to student-work-index.png.
What is the link to your site? hidden link
Hello,
Please elaborate the question with more details:
but two is out of my grasp
You can create view, to query posts in both post type: "Project" and "Thesis".
For example, you can create a post view, in section "Content Selection" choose both post type: "Project" and "Thesis".
Why do you think it is out of your grasp?
Luo, thanks for your reply.
I think the place I'm hung up on is in the Loop Wizard. I know that the Post Title can be displayed in the loop (WP will pull the post title from both custom page types), but I want to also show a field named Index Thumbnail. See attached screenshot. This field belongs to two different field groups / post types. Should I just include both of them in the Loop Wizard and use conditional tags in the Content Template to avoid empty areas?
Here's some pseudo code demonstrating my proposal:
[post title and url]
<if there's a project thumbnail>[project thumbnail]</if>
<if there's a thesis thumbnail>[thesis thumbnail]</if>
(I don't understand how to reference a field inside a view that isn't shared between two different custom posts.)
If the custom image field "thumbnail" are using the same field slug, then you just need one Types field shortcode:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
If they are using different field slug, then you need to display it with different shortcode, and you can use wpv-conditional shortcode to check the post type of current post, then display different content, see similar thread here"
https://toolset.com/forums/topic/what-is-the-correct-syntax-to-conditionally-display-based-on-wpv-post-type/
This makes sense. For some reason I thought that fields were specific to the custom post types, but a given field can be used with multiple post types.
Thank you, Luo! This solved my issue. 🙂