Skip Navigation

[Resolved] Forms: Add Form link to parent post?

This support ticket is created 6 years, 5 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1078597

For the single post version of a CPT, I've added a Toolset Form link to edit the post. The link goes to a page that contains the relevant Form for the post.

Is it possible to also add a link on the this same page that links to a different page with a Form to edit a related post (parent/sibling)?

So in other words, is there some way to insert an Edit Form link in a post that will then allow for a related post to be updated? Maybe by changing the context using a View/Content Template?

#1078676
query-filter.png
post-selection.png

Hi, yes you can set up something like this. Here's how I would go about it:
- In the Content Template that includes the Edit Child Post Form, insert an edit post link and use the Post Selection tab to specify you want to choose a post related to the current post, set by a post relationship. Select the parent post type, and select a Content Template that includes an Edit Parent Post Form. See post-selection.png for an example. Now you have a link to edit the parent post from the child post editor.
- To display edit post links for sibling posts, you must first create a View of those sibling posts. Select the child post type and add a post relationship filter, set to Select posts in your parent/child relationship that are related to the Post with ID set by the shortcode attribute "wpvrelatedto". See query-filter.png for an example of this kind of Query Filter.
- Make sure "Don't include the current page in query results" is checked so the current post does not appear in the View of siblings.
- In the Loop Output of this View, insert an edit post link, set to edit the current post, and choose the Content Template that contains the Edit Child Post Form.
- Insert this View into the Edit Child Post Content Template. Use the shortcode attribute "wpvrelatedto" to pass in the parent post's ID like this:

[wpv-view name="chapter-siblings" wpvrelatedto="[wpv-post-id item='@book-chapter.parent']"]

Your post and relationship slugs will be different, but the idea is the same - get the parent post's ID, and pass it into the post relationship filter of the View of sibling posts. This technique is called "passing arguments into Views" and is described in more detail here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

Let me know if you get stuck and I'll take a look.

#1079708

Thanks Christian, I'm just working my way through this now. Will get back to you if I've got any questions.

#1080656

Sounds good, reply when you are ready to continue. This ticket will stay open for 30 days.