Skip Navigation

[Resolved] Title of realtionship post in view

This thread is resolved. Here is a description of the problem and solution.

Problem:

How to connect the parent/child posts in the child post form?

Solution:

In the single parent post, you can get the current parent post ID with shortcode:
[wpv-post-id item="$current_page"]

And use above shortcode as default value of relationship field of child post form.

Relevant Documentation:

This support ticket is created 2 years, 1 month 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 12 replies, has 2 voices.

Last updated by Dido 2 years ago.

Assisted by: Luo Yang.

Author
Posts
#2322159
view-in-view.JPG
parent-view.JPG
message.JPG

Hi
On hidden link I made a view where messages on posts are displayed.
A message can be filled in in a form, for instance here hidden link
I want to show the title of the parent post in this view, but It does not work yet.

I see now all the titles who have messages in one row, in stead of the title of the parent post.
In the screenshot, you see the output of the message (form) of these two articles:
hidden link
hidden link

So, if I fill in a form in a third article, I would have here 3 links. How can I filter the output of this title.
Images: view in view -> artikelen
parent view -> messages

what to do with it?

#2322619

Hello,

I assume we are talking about one-to-many post type relationship.

If it is, in the single child post, you can display parent post information with "item" attribute, for example:
[wpv-post-link item="@my-relationship.parent"]

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
@{relationship-slug}.parent to obtain data from the related parent.

#2322757
relation.JPG

Hi,

I tried this also [wpv-post-link item="@artikel-message.parent"] but I see nothing.
I made a child view because of this message wich occur when I choose the code.

#2323539

Please provide a test site with the same problem, fill below private message box with login details, also point out the problem page URLs, I need to check it in a live website

#2324507

I assume we are talking about the one-to-many relationship "artikel-message":
hidden link

You need to edit those "message" posts, connect it with "artikel" post, for example, edit this one:
hidden link
in section "artikel Message", connect it with "artikel" post: Test

Test it in frontend:
hidden link

I can see it works fine:
REACTIE OP: TEST

Can you confirm it?

#2325315

Hi,

I see this is the purpose.
Why is the connection not made automaticily?

I think this is a bug.

I have noticed this on other websites too.

#2325505

Toolset plugins won't connect posts automatically, if you want to connect posts with the child post form, please our document:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/
section "Creating Forms with a Parent Post Preselected"

#2326853

Hey Luo,

I tried this solution, but it is not working yet. It is more complicated than the example in the document.
I have the same problem with adding a new "Artikel".
I made a video for you, to show you my issues.

hidden link

#2328585

Thanks for the video.

I have done below modifications in your website:
1) Edit the post form "Nieuw bericht":
hidden link
section "Form Editor", line 49, add below codes:

[cred_field field='@artikel-message.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="$current_page"]']

It will output the parent post selector in frontend, and use the current "artikel" post ID as the default value

2) Test it in front:
hidden link
You should be able to see the parent post selector, after user submit the post form, it will connect the message box with parent post automatically.

3) And you can use CSS codes to hide it from user, for example:

div[data-item_name="select-@artikel-message.parent"]{
display:none;
}
#2328699

Yes! Thank you very much.
I will try this with my other form. When that also will succeed, I will close the ticket.

#2328817
select.JPG

Hi Luo,

It also works fine on hidden link but 1 question:

How can I set the value by default? Like at the messages form?
This is what I have:
[cred_field field='@antiquair-artikel.parent' class='form-control' output='bootstrap' select_text='--- not set ---' author='$current']

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/how-can-i-set-the-value-by-default/

#2329209

I assume the original question of this thread is resolved, for other new questions, please check the new thread here:
https://toolset.com/forums/topic/how-can-i-set-the-value-by-default/

#2329359

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.