Skip Navigation

[Resolved] Split: Showing related post's information

This support ticket is created 2 years, 11 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 – 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/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Paul 2 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2236115

Hi there,

Also I can't find anyway to show fields from School on a teachers post. I want to show fields displaying info about the school they are a child of. Nothings displaying and I've checked and verified the Access plugin...

#2236139

With this one, I have a template called "Dashboard" where the user logs in to.

On there, I want to show the details of the School they are assigned to via Relationships. I've tried everything including checking Access, but no fields are being output.

I have also setup a post relationship field between Teachers and Schools but this hasn't helped.

#2236141

Hi,

If you're using the shortcodes to show the content on the single teacher post, you can use the item attribute:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

For example, suppose that the relationship slug of the relationship between schools and teachers is "school-teacher", where "school" is parent and "teacher" is a child in the relationship.

To show the related parent 'school' title on a single "teacher" post page, you can use the "wpv-post-title" shortcode with the item attribute, like this:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-title


[wpv-post-title item="@school-teacher.parent"]

Similarly, you can use the item attribute with most of the Toolset Views and the Types fields shortcodes:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes
https://toolset.com/documentation/customizing-sites-using-php/functions/

regards,
Waqar

#2238427
Screenshot 2021-12-06 at 19-47-16 Edit Content Template ‹ 360 Skills For Life — WordPress.png
Screenshot 2021-12-06 at 19-46-15 Relationships ‹ 360 Skills For Life — WordPress.png
Screenshot 2021-12-06 at 19-44-22 Edit teacher ‹ 360 Skills For Life — WordPress.png

Hello there,

Please see attached. The teachers are definately connected with a school, but nothings coming out on the frontend. Please can you help me? I've tried every combination possible and still nothing.

Many thanks

#2238701

Thank you for sharing these screenshots.

The "item" attribute approach that I shared would work, if the current post's scope is set to the "teachers" post. But from the screenshot, it looks like, you're trying to use it on a generic dashboard/my account page.

Here are the steps that you can follow:

1. Please create a new content template and name it something like "Teacher info on Dashboard".

In this content template, you can move the content that you need to show from within the current user's teacher's post or its related school.

2. In your content template "Dashboard" you can load this new content template, using a shortcode:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body )


[wpv-post-body view_template="Teacher info on Dashboard" item="[current_teacher_id type='teacher-post-slug']"]

Please note how I've used the custom shortcode "current_teacher_id" suggested in the other ticket ( ref: https://toolset.com/forums/topic/split-using-relationship-form-and-the-add-new-post-form-on-the-same-page/#post-2237989 ), in the template's "item" attribute.

This way, the current post's scope will change to the current user's teacher post, inside the new content template.

#2239019

Thanks so much for your help - that works perfectly.

My issue is resolved now. Thank you!