Tell us what you are trying to do?
I am trying to display a list of lectures (which is a custom post type), grouped by their topic (another custom post type) displayed in a custom sort order (a field within the Topics Lectures relationship).
Is there any documentation that you are following?
I have read through everything I can find on your website and viewed a few YouTube videos related to post relationships. I've tried to do everything they say, but have been unsuccessful after spending many long hours over the past 2 months.
Is there a similar example that we can see?
The end result should ultimately look like this static HTML mockup I have produced: hidden link.
What is the link to your site?
hidden link
Hi, to sort by a custom field in the intermediary post type, you must use a View of the intermediary post type. Here's how I would set this up.
- Create a View of Topics. In the Loop Editor, place the post title shortcode for testing purposes.
- Place the View of Topics on the site and make sure the Topic titles that appear are sorted / filtered as needed.
- Create a View of the intermediary post type in your Topics / Lectures post relationship.
- Sort this View using the custom field applied to the relationship / intermediary post.
- Add a Post Relationship Query Filter and select the Topics / Lectures relationship, where the parent Topic is set by the current post in the loop.
- In the Loop Editor, place the post title shortcode for testing purposes. In the popup where you can configure the options for the post title, use the Post Selection tab to select the related Lecture post. This will display the Lecture title, even though the View is of the intermediary post type.
- Place the View of intermediary posts inside the Loop of the View of Topics, and test it out. You should see Lectures grouped by Topic.
- Once you have the post titles of the Lectures and Topics displaying correctly, go back and replace those shortcodes or add to them to display more information about the two post types. In the View of intermediary posts, be sure to use the Post Selection tab to choose the appropriate related post.