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...
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.
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
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
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.
Thanks so much for your help - that works perfectly.
My issue is resolved now. Thank you!