Tell us what you are trying to do?
I’m building a vacancy section on a charity site.
Is there any documentation that you are following?
I followed the custom post type, creating views, creating content templates and displaying related Child post documentation. All of these work fine and I am able to show child application submission made throug cred form via child post link on parent post single content template.
However, guests are able to see applicant details (I have used access to restrict the childpost content but I can’t restrict just the view calling the related child post in the single parent content template. And I don’t like having it there.
How do I create a view that calls the related child posts in a separate page from the single parent post content template
Is there a similar example that we can see?
What is the link to your site?
Hi, you can set the Post Relationship filter to respond to a shortcode attribute 'wpvrelatedto', like you see in the screenshot here. Then when you place the View shortcode on another Page or in another template, you can pass in the parent ID as a shortcode attribute. For example:
This will show the child posts related to parent post with ID '12345':
[wpv-view name='Your View of Child Posts' wpvrelatedto='12345']
This technique is called "Passing arguments to Views", and it helps make your Views dynamic. We have some documentation available here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/
Let me know if you have questions about this.
Hi can I swop out there later to with parent post, how do I distinguish between different parent posts
[wpv-view Name=‘your View of child post’ wpvrelatedto=‘12345’]
With
[wpv-view Name=‘your View of child post’ wpvrelatedto=‘$parent’]
If the parent post is the current page, you can choose the Query Filter option "The post where this View is shown."
If the child post View is displayed in a View of the parent post, you can choose the Query Filter option "The current post in the loop".
If the child post View is displayed on a child post (sibling), you can use the wpv-post-id shortcode to get the ID of the parent post, then use it to set the value of the wpvrelatedto shortcode:
[wpv-view name='your View of child post' wpvrelatedto='[wpv-post-id item="@your-relationship-slug.parent"]']
Thx, but I think I want to do something else than the options you gave.
I want to create a link from the parent post to a new page where I want to show a view that contains a list of the related child posts for the parent post I linked from.
That way I can use the same page and just create the link in the parent single content template.
I hope that make sense, and that there is a simple solution for that.
Thx
Waldo
Okay yes, I understand. The simple solution here is to use a URL parameter to set the parent ID. In the screenshot of the Query Filter I posted earlier, you could choose the option "The post with ID set by a URL parameter: wpv-related-to".
Then on the parent post page, you can use HTML to create a link that includes the parent post ID in the URL parameter like this:
<a href="<em><u>hidden link</u></em>;">Link to the page containing the View</a>
That worked great thx, Im getting to understand toolset better now.
One more question
How would I now draw other info from the parent post into this end page.
For example I want to show the parent post tiltle and then the child post list
"
This is the job Title (parent post title)
- An applicants who applied (this I now have)
- An applicants who applied
- An applicants who applied
"
thx
Dont worry sorted it:
Created a new view showing parent title only and then called related child posts.
Easy, Should have done that from the start, but at least I learned something new thx
Waldo
My issue is resolved now. Thank you!