Inicio › Toolset Professional Support › [Resuelto] display only events (parent) where all game dates (child) are lying in the past
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 |
---|---|---|---|---|---|---|
- | 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)
Etiquetado: Displaying post relationships, Views plugin
Documentación relacionada:
Este tema contiene 17 respuestas, tiene 2 mensajes.
Última actualización por alexanderL-2 hace 6 años, 3 meses.
Asistido por: Minesh.
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
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?
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
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.
Well - I made some changes to your view's settings - especially to filter:
=> enlace oculto
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.
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
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
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
Ok - could you please check now:
=> enlace oculto
I've created another parent view and added the view which you created inside the view I've created. (so, its nested views):
=> enlace oculto
Also, I've adjusted the query filters to "Programmarchiv View" view:
=> enlace oculto
I can see now, its displayed child posts group by parent title.
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
Well - to do that, I've changed the view accordingly:
=> enlace oculto
And pass the parent post title link with custom shortcode attribute name url .
And then with your child view:
=> enlace oculto
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.
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.
Well - could you please share page where you display past events and where you display future events.
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:
enlace oculto
(view: enlace oculto )
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.
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.