Skip Navigation

[Resolved] Add link to parent page

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to display a link to the parent post.

Solution:

In this case it was a hierarchy type relationship where the parent is the same CPT. In this case you will use.

[wpv-post-link id='$parent']

This support ticket is created 6 years, 4 months ago. 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 8 replies, has 2 voices.

Last updated by rainman 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1085802
child page.png

I have this content template code

<!-- Begin Template for Attorneys -->
<h1 class="entry-title">[wpv-if evaluate="'[wpv-post-id id="$parent"]' != '[wpv-post-id]'"][wpv-post-title id="$parent"] - [/wpv-if]<span>[wpv-post-title]</span></h1>
[wpv-conditional if="( NOT(empty($(_thumbnail_id))) )"]
  <div class="featured-image tablet-right">
      [wpv-post-featured-image size="full"]
  </div>
[/wpv-conditional]
<div class="entry-body">
  [wpv-view name="view-for-award-badges"]
  [wpv-post-body view_template="none"]
</div>
<div class="practice-areas tablet-right">
  <h2>Practice Areas</h2>
  [menu name="practice"]
</div>
<!-- End Template for Attorneys -->

It generates pages like the screenshot.

When the page is a child page, I want the Attorney name to be a link back to the parent page.

#1085834

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

So you want to do is to make your Page title clickable to the parent?

Is the Parent the same custom post type or is it in another CPT?

Please let me know.
Thanks,
Shane

#1085841
post-type.png

Not the whole page title, just the attorney's name, which is the title of the parent page.

They are all the same post type. See screenshot showing all the pages and relationship for this post type. I have circled all the parent pages.

#1085850

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Then you should be able to use this.

<a href="[wpv-post-link id='$parent' output='raw']">[wpv-post-title]</a>

Please let me know if this helps.
Thanks,
Shane

#1085855
CODE.png

Looks like that would link the page title ("Practice Areas" in my example). I want to link the parent page title which comes before the hyphen. See new screenshot of the line of template code that generates the H1 heading.

#1085861

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

In this case you would need to do this.

[wpv-post-link id="$parent"]

Please let me know if this helps.
Thanks,

#1085867

I'm confused. Where would that go in my template code?

#1085869

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

You will replace

[wpv-post-title id="$parent"] -

with

[wpv-post-link id="$parent"] -

#1085876

That works. Thanks!!