Dear Support Team,
I have created custom post types "Listing Categories" and "Listing Details".
In "Listing Categories", post are organized as parent- child so that I can have child posts as sub categories.
I have also created a relationship between both post types on the "List Category Type" field.
Now, I am creating a template (example attached) that should acheive the following:
- Display the image and some details coming from the parent post "Listing Categories"
- Display a view of child posts from the "Listing Category"
- Display view of posts from "Listing Details" as per the relation
Part of this is working fine, but I am havong those issues:
- The view is not showing all posts fom the child post
- if I click on one of the view items in the child posts, the relevant posts in "Listing Details are not displayed
Please advise.
Regards,
Aziz
Hi Aziz,
First, we need to make sure that you followed the steps mentioned in the documentation below correctly to create such a parent-child relationship and display it:
https://toolset.com/course-lesson/displaying-related-posts/
Secondly, please check the query filters to see if you added something that might cause the partial loading of the posts depending on the criteria that is set there.
Finally, please check the pagination options and set them a high number in the sidebar of the views block to make sure the pagination would not cause a partial load of the posts.
Thanks.
Hi Chris,
I went through the documentation and videos, but to be honest, it will take me a day or two to try and make sure I follow the right concepts as explained.
I appreciate if this ticket is left open for 1-2 days just to make sure that I fully resolved this issue.
I really appreciate all the support and help.
Regards,
Aziz
Hi Chris,.
Thank you so much. I followed the documentation and was abel to solve the issue.
One question remains, currently I am creating the relationship between two post types manually through the admin dashboard, but how can I make sure that the same relationship is created from the frontend? As an example,
Post Type 1: Listing Category
Post: Dress (PARENT TEXT: Blank)
Post: Wedding Dress (PARENT TEXT: Dress)
Post: Event Dress (PARENT TEXT: Dress)
Post Type 2: Listing Details
- If I want to create a post, as an example, "White Wedding Dress", it should have relation wih the "Dress" and "Wedding Dress"
- If I want to create a post, as an example, "Red Event Dress", it should have relation wih the "Dress" and "Event Dress"
So, is there a way to let the user to seelct the "Dress" and then either "Weddng Dress" or "Event Dress" so that I can build that relation and how?
Regards,
Aziz
Hi Aziz,
You want a three-level relationship. Grandparent (Dress), Parent (Wedding Dress), Child (Red).
You can do it with the same method you do for relationships. You create a relationship Between Grandparent and Parent, and a relationship between Parent and Child.
You will not be able to select the items in one select box, so the user will need to do as follows:
- Go to the grandparent post type and create an entry called Dress.
- Go to the parent post type and create an entry called wedding dress and in the edit screen he/she will have a select box to select Dress as the parent.
- Go to the child post type and add an entry called red and in the edit screen he/she will have a select box to select Wedding Dress as the relationship.
When you want to show that in the front end you will need to have two nested views to child > parent > grand parent.
You can get an idea on how to display such a three level from this ticket:
https://toolset.com/forums/topic/display-children-at-grandparent-level/#post-1174113
Thanks.
Hi Chrism
The posts (Dress/Wedding Dress/Event Dress) were creayed as explained by the admin, so the user is not required to do anything here. The customer post used is "Listing Category".
The user will only add entries to the custom post type "Listing Details" like (Red/Black, Amazing Bridal Dress .... etc) and need to link them to the relevant categories from "Listing Category".
I understood the concept of the nested views, but how can I bring that to a front end form that would be used to create the new "Listing Details" posts?
Regards,
Aziz
Hi Aziz,
The only way to use post forms when adding the content of the post in the form is to use the parent/child method mentioned below:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/
But it is for a parent/child and not the third level.
Also if you want the form to connect the related posts you can use a Relationship form using the method below:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/
Other than the points mentioned above, Toolset doe snot have other built-ion functionality for this matter.
Thanks.