Skip Navigation

[Resolved] Link to parent relationship not working

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

Problem:
A template includes Views shortcodes to output fields which have an id attribute to retrieve the field from a parent post, but it's not working.

Solution:
Client was using the Types 2 format to reference parent posts (using the id attribute) for relationships created with Types 3, which require the item attribute, e.g.

[wpv-post-link item="@project-task.parent"]

Using the Fields and Views button to insert the shortcode and specifying the relationship in the Post Selection tab will insert the shortcode with the correct format.

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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by chrisC-25 6 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#920576

I have a record template setup to show the record and a link back to the associated artist. Here is a link:
hidden link

It should say:
Artist: Billy Gibbons
just under the title. But instead it just repeats the name of the record.

This is what I have for the code:
Artist: [wpv-post-link id="$artist"]

This is working on my other site here:
hidden link

Same code.

The relationship on the artist page pulls in the correct records like here:
hidden link

It must be related to the new relationships? I can not figure out what to change it to.

Thanks

#920671

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Chris

The 'old' format of id="$artist" should continue to work on pre-existing relationships created before Types 3, whether you have run the migration wizard or not, but won't work on relationships created with Types 3.

You'll find the correct format if you use the Fields and Views button to insert the shortcode and in the Post Selection tab specify the related post the field should use as source, which will use a format something like this:

[wpv-post-link item="@project-task.parent"]

where in this case "project-task" is the slug of the relationship defined at Toolset > Relationships.

#920942

Perfect! Thanks Nigel.