Skip Navigation

[Gelöst] display only 1 event, which complies all requirements (published parent & more)

This support ticket is created vor 6 Jahren, 2 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Dieses Thema enthält 12 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von alexanderL-2 vor 6 Jahren, 2 Monaten.

Assistiert von: Minesh.

Author
Artikel
#1114870

I have a one-to-many post relationship. Now I would like to display a custom post field of a parent post, where views loads the last post depending on a date, which is given in a related child post.

So..
I have an event (parent).
This event has one or more "game days" (child).
Now I would like to display the newest event, depending on the nearest game day from today on home (only one, so view is limited to 1).
That works so far with view.

Problem:
sometime we have a post in pending mode, so it should not be visible to anyone.
I can manage this with this code:

[wpv–conditional if="( '[wpv-post-status item='@cptslug.parent']' ne 'pending' )"]
code here
[/wpv–conditional]

It hides the pending/draft post but also doesn't show any other event. How can i display the first event, which complies all requirements (next date (=game day) and published parent post)?

Thanks
Alex

#1115683

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I think I already have your one ticket assigned.

How can i display the first event, which compiles all requirements (next date (=game day) and published parent post)?
==> I do not understand the question you shared above. Could you please explain with test case example? Once I understand your requirement I would be happy to guide you in the right direction.

#1115728

Hi,

well, on home (versteckter Link) we have a picture on the top (now it is blue with red letters). This image is from one event (slug: produktion) and is loaded by the date of its child posts (spieltermin). That works so far.
Problem:
If my client wants to add but not publish a new event, it is shown there, so we tried to filter it by post-status "if parent post status is publish, show it, if not, call the next available event where parent post status is on publish." But we are not able to manage this because view displays (or hides) only the first event and doesnt jump to the next possible event which fullfills the requirements of "parent post status = publish" and "spieltermin = is the nearest in the future"

Hope the issue is more clear now.

Thanks,
Alex

#1116116

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Which view you are using to display that image? could you please share link to that view?

#1116126

it is "Header-img Startseiten View" (id: 13472)
versteckter Link

Thanks a lot, i appreciate your support.

#1116221

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Could you please check now, I've created the following view and added to display with your home page:
=> versteckter Link

#1116227

Thanks but unfortunately the problem persists. It displays the newest image although its parent post has post status "draft".
It should call the next available event, where parent post status is on "publish" instaed.

Thanks

#1116231

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Ok - I've adjusted the view again:
=> versteckter Link

Please note that there is no way to take next step if parent post has draft status or switch to another post if there is no matching child posts should be matched to date field. The thing is that either you can query post with limit or query all posts. You can not break the loop in middle.

So, what we are doing, we are finding parent post with status=publish and then we are querying its related child post based on date condition and if found, it will display the results, as you can see its currently display the result.

#1116250

This is not working, as we need the date of "spieltermin" to order the post-image.
Maybe it is possible to only save the child post on creating as draft instead of publish it automatically? Then we could filter it by child post status.

#1116297

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Well - whatever but when you set the post as the draft, it will create the issue with the relationship.

And I do not see this is logical as well, because you have one To many relationship between your post type. The only way to achieve this is using the custom query which needs custom programming that is beyond the scope of our support policy.

I think you need to look at your structure or consult some experts.

And as I acknowledge that there is no way to switch the view's loop in such cases like " if parent post has draft status or switch to another post".

#1116306

yeah, it is quite difficult. I will talk to my client, maybe we find another solution.

Thanks for your help Minesh.

#1116412

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

ahh - could you please close this ticket.

#1116949

My issue is resolved now. Thank you!