Skip Navigation

[Resuelto] Relationship Edit Link Duplicated

This support ticket is created hace 5 años. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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/Karachi (GMT+05:00)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por duongN-3 hace 5 años.

Asistido por: Waqar.

Autor
Mensajes
#1379225

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/

#1379583

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

#1380289

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.

#1380555

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

#1381617

My issue is resolved now. Thank you!