Skip Navigation

[Gelöst] Display link to parent post

This support ticket is created vor 8 Jahre, 3 Monate. 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 2 Antworten, has 2 Stimmen.

Last updated by francoiseR vor 8 Jahre, 3 Monate.

Assigned support staff: Luo Yang.

Author
Artikel
#249373

Hi,
I am trying to display the parent post title with a link. The parent post slug is "lugar"

I tried this:

 <?php echo '<a href="'.get_permalink($lugar->post_parent).'">'.get_the_title( $lugar->ID ).'</a>';?>

But it doesn't work, the title and the link is to the current post (child of "lugar")

How can I solve it?

Thanks in advance

#249683

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Please try Types function wpcf_pr_post_get_belongs(), like this:

<?php
$lugar_id = wpcf_pr_post_get_belongs(get_the_ID(), 'lugar');
echo '<a href="'.get_permalink($lugar_id).'">'.get_the_title( $lugar_id ).'</a>';
?>
#249926

Thank you very much, Iuoy

As ever, excellent support!