Tell us what you are trying to do?
Adding Edit function to a Drama title
Edit is duplicated showing multiple edit links under a Person
Is there any documentation that you are following?
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/editing-existing-connections-between-related-posts/
Is there a similar example that we can see?
enlace oculto
What is the link to your site?
enlace oculto
Original ticket: https://toolset.com/forums/topic/edit-remove-connection-not-working-as-expected/
Hi,
Thank you for contacting us and I'd be happy to assist.
Since the view "Edit Link for Cast-Dramas" is set to show all the "People" posts, which are related to the current "Drama" post, it's output loop is repeating, equal to the number of people posts, connected to the current drama.
To make sure that only the relationship edit link for a single current people post is shown, you can follow these steps:
1. In your view "List of Drama Credits", you can include the current people post's ID in a shortcode attribute.
( ref: https://toolset.com/documentation/user-guides/passing-arguments-to-views/ )
Example:
The current shortcode:
[wpv-view name="edit-link-for-cast-dramas"]
Updated shortcode:
[wpv-view name="edit-link-for-cast-dramas" people="[wpv-post-id item='@cast.child']"]
2. In the child view "Edit Link for Cast-Dramas", you can wrap the relationship edit link in a conditional block, so that it only shows, when the current people post ID and the ID of people post coming from the parent view is the same:
( ref: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/ )
[wpv-conditional if="( '[wpv-post-id]' eq '[wpv-attribute name="people"]' )"]
[cred-relationship-form-link form='edit-drama-cast' role_items='$fromViews' content_template_slug='editing-cast-drama']Edit[/cred-relationship-form-link]
[/wpv-conditional]
As a result, only a single edit link will be shown for each "people" post.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Thanks Waqar!
This has solved my issue, but I have one other question related to the edit link.
Currently I have "Add Cast" to look like this:
enlace oculto
I'd like to have "Edit Cast" look the same way, but it looks like this:
enlace oculto
As you can see the content on the left side doesn't show anything.
I'm using a Content template titled "Editing Cast-Drama" and my code looks like this:
<div class="row">
<div class="col-sm-8">[wpv-post-body view_template="template-for-dramas" parent_item='$current']</div>
<div class="col-sm-4" style="margin-top: 200px;"><h3>Editing Cast</h3>[cred-relationship-form form='edit-drama-cast' parent_item='$current']</div>
</div>
Can you assist with this?
Thanks again for everything.
Hi,
Thanks for the update and glad that it works.
In your content template "Editing Cast-Drama", you have this shortcode to load the drama's content:
[wpv-post-body view_template="template-for-dramas" parent_item='$current']
Since the edit cast form shows on the single cast page and not on the single drama post page, you'll need to update it to use item="@cast.parent".
( ref: https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/ )
[wpv-post-body view_template="template-for-dramas" item="@cast.parent"]
I hope this helps and you're welcome to start a new ticket for each new question or concern.
regards,
Waqar
My issue is resolved now. Thank you!