Skip Navigation

[Résolu] Struggling to link to Parent post/page

This support ticket is created Il y a 2 années et 9 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 1 réponse, has 2 voix.

Last updated by Luo Yang Il y a 2 années et 9 mois.

Assisted by: Luo Yang.

Auteur
Publications
#2097311

Tell us what you are trying to do? Link a post within a loop to its parent page/post instead of itself

Is there any documentation that you are following? NO (I tried several with no luck)

Is there a similar example that we can see? I can provide in a private message

What is the link to your site? I can provide in a private message

On my site I have a page that lists a series of upcoming workshops within a view.
Each item in the loop has a link to its main details page.
For items in the loop that have parents (in my case, post types that are not "workshop") I prefer to link to their parent page instead, but I can't get it to work (although some code used to work in the past.)

I have tried:

[wpv-conditional if="( '[wpv-post-type]' ne 'workshop' )"]<a href="[wpv-post-url item='@workshops-series-events.parent']">More Details</a>[/wpv-conditional]

and:

[wpv-conditional if="( '[wpv-post-type]' ne 'workshop' )"]<a href="[wpv-post-link id='$parent' output='raw']" class="myButton">More Details</a>[/wpv-conditional]

But neither seem to work. I'd be very grateful if anyone can help me solve this issue.

#2097617

Hello,

It seems that the custom post type "workshop" is using slug "workshops", please try to change your shortcodes as below and test again:

[wpv-conditional if="( '[wpv-post-type]' ne 'workshops' )"]<a href="[wpv-post-url item='@workshops-series-events.parent']">More Details</a>[/wpv-conditional]
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.