Skip Navigation

[Resolved] Using post reference fields in pages

This support ticket is created 4 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by marcB-6 4 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1256257

Hi guys,
in virtual every site i build i stumble upon the same 'problem', and i was wondering if there is a better solution than the one that i use.

Suppose i create a product landing page template. The template can be used as a regular page template by the admin. The product landing page consists of several elements including a quote slider, a product image slider and a contact person. Those three elements are actually custom post types. In the ideal world the admin can connect the set of quotes, slides or a contact person directly from the landingpage itself using a post reference field. However; this fieldtype is not available since the template is not assigned to a custom post type.

My workaround is to use post ID's. So i create a field called 'Related contact person post ID' and the admin can give in the ID of the related contact person. The problem with this solution is that it's not intuitive for the average admin and it's inconsistent with other post types (since i use the post reference field in CPT's).

So my actual questions are;
- Will the post reference field be ever available for pages?
- Is there a better workaround than the one i use?

Thanks and have a good day!

#1256447
references.png

- Will the post reference field be ever available for pages?
I'm not sure I understand the problem. You can currently use Post Reference Fields with Pages, just like you would use with other post types. See references.png.
1. In a Post reference field applied to some other post type, you can choose Pages as the source post type. My example on the left is a reference field in the "Books" post type, which allows you to connect a Page to a Book.
2. You can add a Post Reference custom field in the Pages post type. My example on the right allows you to connect a Book to a Page.

One thing you cannot do is use a Post Reference field in the Page post type to connect one Page to another Page. This type of self-reference or self-relationship is not currently supported.

However; this fieldtype is not available since the template is not assigned to a custom post type.
Can you give me some more information about this? I'm confused. Maybe some screen shots would help me understand.

#1256573
Schermafbeelding 2019-06-03 om 08.03.01.png
Schermafbeelding 2019-06-03 om 08.02.47.png

Hi Christian,
thanks for your answer and maybe i did not explain myself well enough.
So as said i created a template called 'landing page template'. I created a fieldgroup for this template called 'landing page fields'. I assigned this field set to this template (see first screenshot). I did not assign them to the post type pages since i don't want them to display on every page i create, only on the ones where i select the 'landing page template'. Now, when i try to add a post reference field i get a message that this is not possible (see second screenshot).
I hope this makes things a bit clearer for you 🙂
Thanks!

#1256753

Hi Christian!
Do you know that moment that everything falls in place and you see something you didn't see before? Well; i have that eureka moment right now. By assigning the field group to both a template and a post type (landing page template AND page) i am able to add repeatable field groups and post relations. I need to do some reverse engineering for everything we worked on in the last months ;).
Thanks for pointing me in the right direction!
Marc

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.