Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #1418319

    Hey @Ismael, we’re still having the issue I noted in my last post in this thread (https://kriesi.at/support/topic/using-blog-element-for-events-calendar-listings-need-to-order-by-event-date/#post-1405617) where recurring events are not showing. For example the Upcoming Events box at the bottom of https://gobhdev.wpengine.com/property/casa-dominguez/ should be showing the After-School Program recurring event (https://gobhdev.wpengine.com/event/after-school-program-2/2023-09-07/).

    Looks like it has something to do with the function below, at the top of my functions.php file — if I comment this code out, the events show. But without that code, the events show in reverse chronological (we want chronological), recurring events are out of order, and all past events show, too (this is how I have it on the live site, for now, so at least the events show: https://gobeyondhomes.org/property/casa-dominguez/). But if I leave this code in, no events show. So maybe something about this function doesn’t jive with the the recurring events?

    Any chance you could help me troubleshoot that? I’m including a temp login and sftp info in the private content. Thanks so much and lmk if you have any questions!

    // QUERY EVENTS BY STARTING DATE
    function avia_blog_post_query_mod( $query, $params ) {
        if(! is_singular( 'portfolio' ) ) 
        {
            return $query;
        }
    
        $include = array();
        $posts = array();
    
        $events = tribe_get_events( [
            'posts_per_page' => 5,
            'start_date' => 'now',
            'orderby' => 'meta_value',
            'meta_key' => '_EventStartDate',
            'order' => 'DESC',
            'tax_query' => $query['tax_query']
        ] );
    
        foreach($events as $event) {
            $date = tribe_get_start_date( $event, false, 'j F Y' );
            $include[$event->ID] = $date;
        }
    
        asort($include);
    
        foreach($include as $key => $value) {
            $posts[] = $key;
        }
    
        unset($query['tax_query']);
        $query['orderby'] = 'meta_value';
        $query['order'] = 'ASC';
        $query['meta_key'] = '_EventStartDate';
        $query['post__in'] = $posts;
    
        return $query;
    }
    add_filter('avia_blog_post_query', 'avia_blog_post_query_mod', 10, 2); */
    #1418713

    Hey sky19er,

    Sorry for the delay. Did you enable the recurring events option in the Event Settings > General panel?

    Best regards,
    Ismael

    #1418718

    Hmm, I don’t see the setting you’re referring to — you mean in Events > Settings > General? You can see the recurring events showing in the Calendar view (eg After-School Program on https://gobhdev.wpengine.com/resources/virtual-events/ ). And on the live site, with the custom code disabled, the recurring events seem to show on the Calendar, but only the past recurring events seem to show in the listings on the property pages (eg After-School Program on https://gobeyondhomes.org/property/casa-dominguez/ ). Does that offer any clues? Thanks again!

    #1418721

    Hi,

    We have added the tribeHideRecurrence parameter to the tribe_get_events function and set the parameter’s value to false. Let us know if this changes anything.

    
    // Blog Posts: Query events by starting date
    function avia_blog_post_query_mod( $query, $params ) {
        if(! is_singular( 'portfolio' ) ) 
        {
            return $query;
        }
    
        $include = array();
        $posts = array();
    
        $events = tribe_get_events( [
            'posts_per_page' => 5,
            'start_date' => 'now',
            'orderby' => 'meta_value',
            'meta_key' => '_EventStartDate',
            'order' => 'DESC',
            'tribeHideRecurrence' => false,
            'tax_query' => $query['tax_query']
        ] );
    
        foreach($events as $event) {
            $date = tribe_get_start_date( $event, false, 'j F Y' );
            $include[$event->ID] = $date;
        }
    
        asort($include);
    
        foreach($include as $key => $value) {
            $posts[] = $key;
        }
    
        unset($query['tax_query']);
        $query['orderby'] = 'meta_value';
        $query['order'] = 'ASC';
        $query['meta_key'] = '_EventStartDate';
        $query['post__in'] = $posts;
    
        return $query;
    }
    add_filter('avia_blog_post_query', 'avia_blog_post_query_mod', 10, 2); 
    
    

    Thank you for your patience.

    Best regards,
    Ismael

    #1418723

    Thanks, but that didn’t seem to do it — still nothing showing on https://gobhdev.wpengine.com/property/casa-dominguez/ . I set up the Dev site and gave you admin and sftp info so you can troubleshoot without me being in the middle, if you want. Thanks again and lmk if you have other questions.

    #1418752

    Hi,

    It is now displaying the latest event (Youth Social: Goal Setting) but the recurring events are still not shown even though they are queried properly. Have you tried forwarding the thread to the tribe events support? We might have missed an option or query parameter.

    This is the latest modification in the filter.

    
    // Blog Posts: Query events by starting date
    function avia_blog_post_query_mod( $query, $params ) {
        if(! is_singular( 'portfolio' ) ) 
        {
            return $query;
        }
    
        $posts = array();
    
        $events = tribe_get_events( [
            'posts_per_page' => 6,
            'start_date' => 'now',
            'orderby' => 'meta_value',
            'meta_key' => '_EventStartDate',
            'order' => 'ASC',
            'tribeHideRecurrence' => false,
            'tax_query' => $query['tax_query']
        ] );
    
        foreach($events as $event) {
            $posts[] = $event->ID;
        }
    
        unset($query['tax_query']);
        $query['post__in'] = $posts;
    
        return $query;
    }
    add_filter('avia_blog_post_query', 'avia_blog_post_query_mod', 10, 2); 
    

    Best regards,
    Ismael

    #1419448

    Thanks, Ismael. I can try bouncing over to tribe events support, but looking at the display that only uses their elements — https://gobhdev.wpengine.com/resources/virtual-events/ — everything seems to be working properly. Have you already seen that display / does that offer any clues?

    Also, just in case it helps, I’ve noticed the single events seem to come and go on a property as I play with the recurring events assigned to the same property. For example, it seems like if I add more than three days to the After-School Program recurring event — depending on which days of the week I add — the single event on Casa Dominguez disappears. But again, regardless, https://gobhdev.wpengine.com/resources/virtual-events/ shows everything.

    Thanks again.

    #1419451

    Hi,

    everything seems to be working properly. Have you already seen that display / does that offer any clues?

    Yes, we noticed that, but I think what complicates the issue with the Blog Posts element is the use of the custom taxonomy “Properties”. This is not applied to the events page, which displays all items regardless of the category they belong to. It would be helpful if you could ask their team for the actual query for the recurring events so that we can apply it to the Blog Posts element. Also, it appears that recurring events may require specific conditions that we are not aware of, so it would be very helpful if they could provide input on that as well.

    Best regards,
    Ismael

    #1419505

    OK, but in crafting my ticket for them, I also noticed, even with single day events, I can only get one event to show at a time — only the next upcoming event. For example, I set up a “test single” event for 9/24, we have the September Resident Meeting on 9/26, and I added a “test single 2” event for 9/30 — if those are all assigned to Casa Domingues, only the 9/24 event will show ( as I have it now https://gobhdev.wpengine.com/property/casa-dominguez/); if I unassign that event, the 9/26 event will show; and if I unassign that event, the 9/30 one will show. Does that offer any clue, or should we get that sorted out before I submit my ticket to tribe?

    Also, btw, I removed the All Properties taxonomy from the Blog Posts element for Casa Dominguez, to avoid confusion (see https://capture.dropbox.com/99EZcqUs4lQKSboL ).

    And I forgot to mention, I noticed previously it looked like you’d checked the Events > Settings
    > Condense events in Series option, but I think it’s better to leave that unchecked (https://capture.dropbox.com/UHDCW3rrEp2dLByu ) to make sure folks can see there are events available throughout the week, for example.

    I also forgot to mention that I noticed previously it looked like you added an _bak to the shortcodes folder in the child theme (see https://capture.dropbox.com/WHiEPCI64AzsbJns ) — that _bak was lost when I recopied the live site to dev, awhile back, to get the latest WLM (WishLIst Member) update — should we add the _bak to that folder? I hope I didn’t screw you up by recopying the live site like that.

    Thanks again so much for sticking with me on this, and lmk if you have any questions.

    #1419543

    Hi,

    I can only get one event to show at a time — only the next upcoming event.

    Yes, we’ve noticed this issue. For some reason, recurring events cannot be retrieved when using the query_posts function with the post__in parameter, which is the default function used by the Blog Posts element to fetch the posts. In the filter above, we are using the default tribe_get_events function to obtain the IDs of the first 6 related items, which works correctly. However, when we pass these IDs to the query_posts function using the post__in parameter, it only returns non-recurring events.

    should we add the _bak to that folder?

    We just disabled the custom shortcodes just to test if it conflicts with the Blog Posts element. You can enable it back.

    I noticed previously it looked like you’d checked the Events > Settings
    > Condense events in Series option

    Yes, you can leave this option disabled.

    Best regards,
    Ismael

    #1419614

    Thanks again, Ismael, but it’s not even showing all the non-recurring events — it’s only showing one event at a time, even if they’re just separate, single/one-time/non-recurring events. Just making sure — did you understand me on that? Thanks again.

    #1419649

    Hi,

    but it’s not even showing all the non-recurring events

    Yes, we understand. It’s displaying only one event, which is likely due to the fact that we are only retrieving six items at a time. During testing in the casa-dominguez page, when we use the tribe_get_events function, it returns five recurring events and one non-recurring event. However, as mentioned earlier, the query_posts function doesn’t retrieve recurring events, resulting in only one item being displayed. We could try and adjust the value of the posts_per_page parameter in the query to retrieve more items, but it will still ignore recurring events.

    Best regards,
    Ismael

    #1419784

    Thanks Ismael, I bounced it over to them and they responded with this:

    Though customizations like this are technically, not covered by support, we always do all we can. The place to start with setting up queries for our recurring events is here: https://docs.theeventscalendar.com/apis/custom-tables/events/ . Hope this helps and Please let me know if you have any questions.

    Can you work with that or is it too minimal/vague? Thanks again.

    #1419825

    Hi,

    Thank you for the info.

    It turns out that post ID is different from event ID, which is why we can’t retrieve the recurring events. We modified the filter in the functions.php file a bit to check if the an item is part of a series and fetch the actual post ID.

    foreach ($events as $event) {
            if(tribe_is_recurring_event($event->ID))
            {
                $posts[] = tec_series()->where( 'event_post_id', $event->ID )->first()->ID;
            } else {
                $posts[] = $event->ID;
            }
        }
    

    As you may notice, the “After-School Program”, which is a recurring event, is now included in the list.

    Best regards,
    Ismael

    #1419827

    Nice! Any idea why only four events show, and why they seem to be out of order?

    #1419831

    Hi,

    We adjusted the query a bit to sort the items by start date. Please note that the date that is displayed in the front end is the modified or published date, not the event start date. You can hide this date by adding this css code.

    time.date-container.minor-meta.updated {
        display: none;
    }

    Best regards,
    Ismael

    #1419999

    Thanks again, Ismael. I hate to keep pestering you about this, but, for a couple of years we did have the events dates showing instead of the publish dates — did we somehow lose that code along the way, or could it have something to do with the // ADD POST SORT OPTIONS TO ENFOLD ELEMENTS code at the bottom of our functions.php file? Let me know if I’m asking too much. We also need to be able to show more events, farther into the future.

    #1420015

    Hi,

    Sorry for the confusion. It turned out that the start date are already displayed in the frontend but for recurring events, only the initial event start date is displayed instead of the occurrence start date. To fix this issue, we modified the loop-index.php file in the child theme.

     if(get_post_type(get_the_ID() == 'tribe_event')) {
                    $time = tribe_get_start_date(get_the_ID(), true);
    
    				$next_occurrence = tribe_events()->where( 'series', get_the_ID() )->where( 'starts_after', 'now' )->first()->ID;
    
    				if($next_occurrence !== NULL)
    				{
    					$time = tribe_get_start_date($next_occurrence, true);
    				}
                } 
    

    If you want to display more items, just edit the avia_blog_post_query_mod filter in the functions.php file. Adjust the value of the posts_per_page parameter around line 15 and 34.

    line 15:

    $events = tribe_get_events( [
            'posts_per_page' => 10,
            'start_date' => 'now',
            'tribeHideRecurrence' => 0
        ] );
    

    line 34:

    $query['posts_per_page'] = 10;
    

    Best regards,
    Ismael

    #1420079

    Nice, getting so close. But the recurring events still only seem to be showing the one/next future event — we need to show the other days for those events — can we get more of those recurring events to show? Also, thanks for pointing out the two two spots for updating the number of posts — I had tried the first one but missed the second — but now that number overrides the Pagination option in the Blog Posts element, eh? That may not be critical, but I know the client would like some pagination, especially if we can get more recurring events to show. Thanks again, SO much!!

    • This reply was modified 6 months, 1 week ago by sky19er.
    • This reply was modified 6 months, 1 week ago by sky19er.
    #1420220

    Hi,

    . But the recurring events still only seem to be showing the one/next future event

    Only the next occurrence of a recurring event is displayed because there seems to be no way to retrieve recurring events when using query_posts, which is the default function used by the Blog Posts element. When we try to retrieve the post object ID based on the occurrence ID, it always return the ID of the parent event, not the actual post object ID of the occurrence. We can’t find any solutions in the documentation.

    Have you tried using the tribe events shortcodes instead of the the Blog Posts element?

    // https://theeventscalendar.com/knowledgebase/embedding-calendar-views-with-the-tribe_events-shortcode/
    // https://theeventscalendar.com/knowledgebase/shortcodes/

    Best regards,
    Ismael

    #1420327

    Ah, ok, thanks for explaining. I think I did originally exhaust the possibility of using their shortcode, including their extra Filter Bar plugin, and then that other ECS (Events Calendar Shortcode) plugin, but in the end using your Blog Posts element was what finally did the trick — but I can’t say I’m positive we ever had the recurring events working correctly. And that was several years ago, now. So, I’ll bounce your explanation back to tribe and see if they either have an solution or if some improvements in tribe events and/or ECS since then might get us what we need. Thanks again for all your help!

    #1420355

    Hi,

    Thank you for your patience. If you have additional questions, please open a new thread and provide the link to this thread for reference. We’ll close this thread for now as it’s getting a bit lengthy.

    Have a nice day.

    Best regards,
    Ismael

Viewing 22 posts - 1 through 22 (of 22 total)
  • The topic ‘recurring events not showing’ is closed to new replies.