Tagged: masonry, the events calendar
-
AuthorPosts
-
January 27, 2021 at 6:46 pm #1275847
Hi,
I would like to show Events form the events calendar in the masonry, so far so good. However, past events should not be visible and events should sort by start date of the event.
I found 3 posts about it, both with the same filter, see below.
https://kriesi.at/support/topic/enfold-masonry-blog-modern-tribe-calendar-other-posts/
https://kriesi.at/support/topic/the-events-calendar-and-masonry-sorting/
https://kriesi.at/support/topic/problems-with-masonry-element-with-the-events-calendar/The filter helps to hide the events that are over but the sorting isn’t going well. Could you have a look and let me know what is wrong.
Thanks in advance!
Regards,
Ariane/* MODERN TRIBE CALENDAR FILTER*/ add_filter(‘avia_masonry_entries_query’, ‘avia_masonry_entries_query_mod’, 10, 2); function avia_masonry_entries_query_mod( $query, $params ) { $eventquery = array(‘paged’=> false, ‘eventDisplay’ => ‘list’); $upcoming = Tribe__Events__Query::getEvents( $eventquery, true); $include = array(); foreach($upcoming->posts as $key => $event) { $include[] = $event->ID; } if(is_page(9002)) { $query[‘post__in’] = $include; } return $query; } /* END MODERN TRIBE FILTER*/
February 1, 2021 at 5:19 am #1276681Hey ariane1001,
Sorry for the delay. Try to adjust the $eventquery so that the items are sorted by events date, so..
$eventquery = array(‘paged’=> false, ‘eventDisplay’ => ‘list’);
.. should be adjusted to.
$eventquery = array(‘paged’=> false, 'orderby'= => 'event_date', 'order' => 'ASC',);
Best regards,
IsmaelFebruary 2, 2021 at 5:57 pm #1277183Hi Ismael,
Thanks for your answer.
I got some erorrs on the syntacs en I changed it to
$eventquery = array('paged'=> false, 'orderby' => 'event_date', 'order' => 'ASC');
But it’s not working? Could you take another look?
I added a temporary login below.Thanks in advance,
ARianeFebruary 4, 2021 at 5:04 am #1277516Hi,
Thank you for the update.
We adjusted the value of the is_page function so it uses an array.
if(is_page(array(197, 3636, 4555))) {
We also created a test page. (see private field)
Best regards,
IsmaelFebruary 9, 2021 at 5:06 pm #1279155Thanks,
But it is still not working?
– Events in de past are still visible?
– Events are still shown by publication date in stead of by startdate of the event?
So is it possible to get the code working or is it not working anymore with the latest versions of Enfold?
I extended the login so you can still take a look if you want.
Thanks in advance,
Regards,
ARianeFebruary 11, 2021 at 3:05 pm #1279769Hi,
Would you mind providing access to the file server so that we could test this properly? Please post the login details in the private field.
Thank you for your patience.
Best regards,
IsmaelFebruary 11, 2021 at 3:55 pm #1279784Hi Ismael,
Below the link to the fileserver. You should be logged in strait away, if not let me know.
Regards, ArianeFebruary 12, 2021 at 2:56 pm #1280050Hi,
Thank you for the info.
Unfortunately, we get a HTTP/1.1 401 Unauthorized error when we try to access the link above. Would you mind creating an FTP account instead so that we could use an FTP client? Please include the WP info in the private field as well.
Best regards,
IsmaelFebruary 12, 2021 at 4:22 pm #1280089This reply has been marked as private.February 15, 2021 at 2:37 pm #1280546Hi,
Thank you for the info.
We modified the code a bit and use the tribe_get_events function instead of forming a new query. Only the upcoming events are not displaying in the front end. (see private field)
/* The evens calendar order */ function avia_masonry_entries_query_mod( $query, $params ) { $include = array(); $events = tribe_get_events( [ 'posts_per_page' => $query["posts_per_page"], 'start_date' => 'now', ] ); foreach($events as $event) { $include[] = $event->ID; } if(is_page(array(197, 3636, 4555))) { unset($query['tax_query']); $query['post__in'] = $include; } return $query; } add_filter('avia_masonry_entries_query', 'avia_masonry_entries_query_mod', 10, 2);
Best regards,
IsmaelFebruary 24, 2021 at 1:45 pm #1283395Hi Ismael,
Thank you very much. It is working now, even on the homepage. I had to adjust the order there and then it went perfect.
Very glad with the new code.
Thanks again,
Best regards,
ArianeFebruary 25, 2021 at 5:53 am #1283584Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘enfold masonry sort by date in the events calendar’ is closed to new replies.