Skip Navigation

[Gelöst] display only events (parent) where all game dates (child) are lying in the past

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 17 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von alexanderL-2 vor 6 Jahren, 1 Monat.

Assistiert von: Minesh.

Author
Artikel
#1114213

Hi,

I have built a one-to-many relationship. Events (parent) // Game dates (child)
I am trying to display all events (parent post) where all game dates are over/lying in the past.

How can i manage this with view?

Thanks,
Alex

#1114817

Minesh
Supporter

Sprachen: Englisch (English )

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

Hello. Thank you for contacting the Toolset support.

Well - as I understand, you want to display parent (Event) title if and only if the child (Game Dates) belongs to past dates - so basically, you want to display past event titles - correct?

Additionally, where you store event date - with date custom field or its a post date field?

#1114874

Hi Minesh,

thanks for your reply.
Yes, I want to display all past events on one page (and on another page all future events.)
The Game dates (child posts) are stored in custom date fields.

One event can have one and more game dates. So it can happen, that an event has eg. 5 game dates where 4 of them are past dates and the last one is a future date. In this case the event has to be hidden on the "archive". Only when all dates are in the past the event should be displayed.

Thanks,
Alex

#1114959

Minesh
Supporter

Sprachen: Englisch (English )

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

Well - you can filter your child post by custom date field and set it to show feature events.

If you can share problem URL and access details, I can set it up for you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1115554

Minesh
Supporter

Sprachen: Englisch (English )

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

Well - I made some changes to your view's settings - especially to filter:
=> versteckter Link

And, I also changed the custom field group "Feldgruppe für Spieltermine" to display with your post type "Spieltermine" and I can see the results.

I can see the parent post title.

#1115657

Thanks but it doesnt solve my problem because it displays all event titles for each upcoming event. It should display the event title only once. Even if there are more than one future event dates.

So in fact it should display each event title once depending if it has one or more event dates in the future/past.

Thanks a lot,
Alex

#1115671

Minesh
Supporter

Sprachen: Englisch (English )

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

So you want the structure like as given under:
-Past Event Title 1
-- Event date 1
-- Event date 2
-- Event date 3
-Past Event Title 2
-- Event date 1
-- Event date 2
-- Event date 3

#1115685

yeah.

so..for example

archive-page:
-Event Title 1
-- Event date 1 (past)
-- Event date 2 (past)
-- Event date 3 (past)
-Event Title 3
-- Event date 1 (past)
-- Event date 2 (past)

and future-page:
-Event Title 2
-- Event date 1 (past)
-- Event date 2 (past)
-- Event date 3 (future)
....

where only "Event title" is shown once

#1116113

Minesh
Supporter

Sprachen: Englisch (English )

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

Ok - could you please check now:
=> versteckter Link

I've created another parent view and added the view which you created inside the view I've created. (so, its nested views):
=> versteckter Link

Also, I've adjusted the query filters to "Programmarchiv View" view:
=> versteckter Link

I can see now, its displayed child posts group by parent title.

#1116121
Screen Shot 2018-09-27 at 08.17.50.png

Thanks, it is nearly done.
It displays also the parent titles when there are no past child post. I have attached an image, where you can see this.
So it needs another filter or conditional which hides the parent title if there are no child posts (if the nested view output = "No items found")

how can we manage this?

Thanks

#1116411

Minesh
Supporter

Sprachen: Englisch (English )

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

Well - to do that, I've changed the view accordingly:
=> versteckter Link

And pass the parent post title link with custom shortcode attribute name url .

And then with your child view:
=> versteckter Link

I'm catching the url shortcode attribute using:

1
[wpv-attribute name="url"]
Just after the shortcode [wpv-items-found], so the parent title only displayed when it has child posts. Could you please confirm and resolve the ticket.

#1116950

Thanks, that works but what i didn't see in the first time, that it doesn't solve the initial issue as it displays also the titles of events where not all sub-event-dates are in the past.

archive-page:
-Event Title 1
-- Event date 1 (past)
-- Event date 2 (past)
-- Event date 3 (past)
-Event Title 3
-- Event date 1 (past)
-- Event date 2 (past)

and future-page:
-Event Title 2
-- Event date 1 (past)
-- Event date 2 (past)
-- Event date 3 (future)
....

As long as an event date has a future date, it should not display the title of the parent on the archive page.

#1117107

Minesh
Supporter

Sprachen: Englisch (English )

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

Well - could you please share page where you display past events and where you display future events.

#1117114

I cannot share page where I display past events, as this is the initial issue which i am trying to solve.
Future Events are displayed here:
versteckter Link

(view: versteckter Link )

And i would like to have the same page just with events their event dates are ALL in the past. As long 1 event date is in the future, it should be displayed on "programm" (=future page). Only when all event dates are past, it should switch to archive page.

#1117115

Minesh
Supporter

Sprachen: Englisch (English )

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

And i would like to have the same page just with events their event dates are ALL in the past. As long 1 event date is in the future, it should be displayed on "programm" (=future page). Only when all event dates are past, it should switch to archive page.
==> Sorry - I do not understand this, have you created feature everns page? If yes - could you please share it or create and tell me where exactly you see the problem.