Saltar navegación

[Resuelto] Shortcode for post-url of child item

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

With one-to-one relationship, display link of related post.

Solution:

You can try view's shortcode [wpv-post-url], for example:

<a href="[wpv-post-url item='@issue-editorspeak.child']">Read More</a>

Relevant Documentation:

https://wp-types.com/documentation/user-guides/views-shortcodes/#wpv-post-url

This support ticket is created hace 4 años, 7 meses. 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)

Este tema contiene 7 respuestas, tiene 2 mensajes.

Última actualización por AlimB3245 hace 4 años, 7 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1648265

Tell us what you are trying to do? I have a custom post called 'issue' and it has a relationshop 'issue-editorspeak' with another custom post 'editorspeak'... I need to create a short code to access the post-url of 'editorspeak' from the issue .. and I am using this .. [types field='post-url' item='@issue-editorspeak.child' output='raw'][/types] .. but it's creating an href to the same page and not to the child post.. This is the main page (issues) enlace oculto and the READ MORE link on the first para (editorspeak) should take the user to this page ..enlace oculto

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?enlace oculto

#1648487

Hello,

How do you setup the relationship "issue-editorspeak"?

If it is one-to-many relationship, then one "issue" post can connect with multiple "editorspeak" posts, so you will need to setup a view to get related "editorspeak" posts, see our document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
section "Displaying many related items"

#1648515

Hi Luo Yang

My Issue Articles relationshop is one to many.. One Issue can have Many Article
But my Issue Editorspeak is one to one.. One Issue can have only One Editorspeak.

Will check link that you sent to me.. but if the solution is something else then please do let me know.

Regards,
Alim

#1648577

For one-to-one relationship, in a single "Issue" post, you can display the related "editorspeak" post information directly with Types shortcode as you mentioned above:
[types field='post-url' item='@issue-editorspeak.child' output='raw'][/types]

I have tried it in my localhost, it works fine.

Please check you are using correct relationship slug and field slug, if you need more assistance for it, please provide a test site with the same problem, I need to test it in a live website, private message box enabled

#1648591
Screen Shot 2020-06-03 at 4.49.39 PM.png

Hi Luo Yang

My staging server is currently being tested by Toolset for another ticket so will provide you access once that is resolved.. in the meantime I checked my code and it's exactly how you asked me to do it..

[types field='post-url' item='@issue-editorspeak.child' output='raw'][/types]

I've attached the screenshot too.. and here's the live link .. enlace oculto

Not sure what I am doing wrong..

Regards,
Alim

#1648733

I don't see anything wrong in your codes, please update here when your test site is ready for debug, private message enabled again.

#1649999

Please check the "EditorSpeaks" post: Vol 8 Issue 2:
enlace oculto

There isn't any custom field is using slug "post-url", the shortcode [types ...][/types] is for rendering custom field value.

If you want to display post URL, you can use view's shortcode [wpv-post-url], for example:

<a href="[wpv-post-url item='@issue-editorspeak.child']">Read More</a>

More help:
enlace oculto

#1650219

My issue is resolved now. Thank you!

Thanks Luo Yang..:-)..

Regards,
Alim