Skip Navigation

[Resolved] Post reference field

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Last updated by Waqar 1 year, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2558793

Tell us what you are trying to do?

I have a many-to-many relationship established i.e. Choruses [*] <<>> Events [*] but I'm getting an error when I try to create a post reference field.

"If you want to list several Chorus items, make a many to many relationship between Choruses and Events. Then, you will be able to connect as many Choruses to any Event."

When I say "make the change" the field disappears.

What is the link to your site? https:/itsasight.com/gc2023

Can you please tell me what I'm doing wrong?

#2559197

Hi,

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

A post-reference field is a type of post-relationship too. This is why, if you've already set up a post-relationship between two post types, you can't connect them again through a post-reference field.

If having a many-to-many relationship is not enough, can you please share some details of the requirement, so that I can share an alternative?

regards,
Waqar

#2562575

Hello Waqar,

I'm just pushing this to the top of your inbox. Do you know how long you expect it will take before my support ticket is answered?

Thanks,
Kim

#2562781

Hi Kim,

Thank you for sharing the access details and for waiting. We had some unusually busy forum queues over the weekend.

I've reviewed the relationships and the items that you mentioned, and here are my findings:

1). Template for Single Event
This template is using a view 'organizers for event', that is showing the related 'Choruses' posts through the relationship 'Chorus Events'.

2). All Events (archive)
This archive is also using the same view 'organizers for event' for showing the related 'Choruses' posts.

3). View - Upcoming Concerts Front used on the home page
When I added this same view's shortcode ( [wpv-view name="organizers-for-event"] - screenshot: hidden link ) in the view 'upcoming concerts front' that is used on the home page, it didn't work.

I updated the query filter for the view 'organizers for event' slightly so that it looks like this:
'Select posts in a Chorus Events relationship that are a related to the current post in the loop.'
( screenshot: hidden link )

As a result, this same view is now working in all 3 sections.
- homepage
- single event pages
- event post-type archive

4). Form - Add an Event
The relationship 'Chorus Events' is of type 'many-to-many' which means that a single event can be linked/connected to multiple 'Chorus' posts.

In such a case, the relationship selection field can't be used in the form to add a new post, which in this case is the form 'Add an Event'.

You can split the process into two steps using two separate forms:

a). User will first use the form to create a new event post ( i.e. form 'Add an Event' ).

b). Once an event post has been created you can redirect the user to that event's single post page, where a relationship form can be used to connect chorus posts as needed. Here is a guide on using the relationship forms:
https://toolset.com/lesson-placement/lesson-placements-1729031-1727277/

I hope this helps and please let me know if you need further assistance.

regards,
Waqar