Skip Navigation

[Resolved] Displaying Fields that Belong to the Related Post

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 4 replies, has 2 voices.

Last updated by Waqar 5 months, 2 weeks ago.

Assisted by: Waqar.

Author
Posts
#2695637

We have clinic post types with connected treatment post types. I want to add a section with three "featured services", which will just be three parts, with some information pulled from three specific treatment posts, that will be different treatment posts for each clinic. While we do already have views on the page that showcase some info from the connected treatments, I need a way to manually choose info from a few treatments, so I went ahead and added Three Post Reference Fields to the field group for clinics, with treatments as the options.

I created a new content template to be used on clinic pages, and am trying to show the content from the reference post fields.

I've been following the documentation on Post Reference Fields(https://toolset.com/course-lesson/using-post-reference-field-to-set-up-one-to-many-relationships/#adding-a-post-reference-field), but when I go to select the Post Source, I don't see the "Parent: <post type name> option". Am I doing something wrong?

#2695782
post-reference-field-example.png

Hi,

Thank you for contacting us and I'd be happy to assist.

I added 3 post reference fields on my test website and was able to see the option for them in the template for the clinics.
(example screenshot attached)

Can you please make sure that the treatment posts are selected in all 3 post reference fields for the clinic post, which is selected as the 'View with' (preview) post in the template?
(you'll see this field at the top of the template screen, also highlighted in the attached screenshot)

regards,
Waqar

#2695799

Thanks for reaching out so quickly. I did have the preview selected correctly and all the treatments connected correctly. It looks like the problem I was having is that I had not set the post types that the content template should be used for. It's working for me now!

#2695817

This is a bit of a different question, but I'm curious, is there a way to make a "default" post reference, similar to how you can add a default value for other field types? Like if some of the clinics haven't chosen specific treatments, it will use certain default treatments? Or would that have to be done individually within the content template (for example choosing default image or title placeholders with conditionals instead of a whole default post reference)?

#2695876

Thanks for the update and glad that it is working now.

For the default "default" post reference field value, your observation is correct and there is no option to set that.

You can use conditional blocks to show or hide content in the template, based on whether these fields are empty or not.

#2695913

Awesome, thank you so much for your help!

Doug confirmed that the issue was resolved on 2024-05-04 13:26:30.
This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.