Recurring Events and Event Widget

This topic contains 13 replies, has 4 voices, and was last updated by  Kiran 7 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #230237

    Steve
    Full Member
    Post count: 1019

    Hello. On my site I have inserted two “Event Widgets” on the home page. The “settings” on the widgets are “Todays” events and “Upcoming” events.

    Here is the problem. The “Upcoming” events has a “recurring” event that is lasting many days. Thus, the recurring event is displaying and taking up the upcoming events area.. it’s a hog! lol

    http://WhatsHappeningToday.com

    Is there a way to “limit” a recurring event from taking up so many of the event positions on the grid?

    #230536

    Kor
    Moderator
    Post count: 16516

    Hi there,

    I’ve just checked with our developer and a workaround for this would be to add the filter below to your functions.php file. However, this will limit all recurring events to display only a single event. I’d suggest that you give it a try and see if it’s what you’re looking for. Let us know how it goes.

    
    
    function geodir_event_single_recurring( $groupby, $post_type ) {
        if ( $post_type == 'gd_event' ) {
            global $wpdb;
            $groupby = " GROUP BY $wpdb->posts.ID ";
        }
        
        return $groupby;
    }
    add_filter('geodir_filter_widget_listings_groupby', 'geodir_event_single_recurring', 100, 2 );

    you can also do the same for search results with this snippet:

    
    
    /**
     * Group the recurring events in search results.
     */
    function gd_custom_group_recurring_events( $groupby, $wp_query ) {
        global $wpdb;
        
        if ( !empty( $_REQUEST['stype'] ) && $_REQUEST['stype'] == 'gd_event' && $wp_query->is_main_query() && geodir_is_page( 'search' ) ) {
            $groupby = $wpdb->posts . ".ID";
        }
        
        return $groupby;
    }
    add_filter( 'posts_groupby', 'gd_custom_group_recurring_events', 100, 2 );
    #230731

    Steve
    Full Member
    Post count: 1019

    Thank you Kor. Is there a way to limit it to a “certain number” such as 2?

    #230785

    Paolo
    Site Admin
    Post count: 31206

    that’s not possible… you can only group them all.

    Thanks

    #230792

    Steve
    Full Member
    Post count: 1019

    Ok. Thank you. I will insert functions code later today. Thank you for your assistance.

    #240717

    Steve
    Full Member
    Post count: 1019

    Yes, this is the “function” that I was referring to and it did not work. I have even disabled the recurring events in the GD setup. Might there be another way? I am going to remove the code so as not to forget to do it later. Thank you Kor and paolo.

    Hey! What’s happening today?

    #240893

    Paolo
    Site Admin
    Post count: 31206

    I asked to the developers to verify that function.

    They’ll let us know asap.

    Thanks

    #241111

    Kiran
    Moderator
    Post count: 7069

    Hi there,

    I checked the snippet code provided by Kor Chung and it working fine.
    Please provide us site FTP access so we can help you to put that code at right place.

    Thanks

    #241530

    Steve
    Full Member
    Post count: 1019

    I am setting up the ftp access now. Please let me know which files you are modifying.

    #241543

    Steve
    Full Member
    Post count: 1019
    This reply has been marked as private.
    #242046

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    Kiran will check and let you know by Monday morning.

    Thanks

    #242866

    Kiran
    Moderator
    Post count: 7069

    Hi,

    I have added function in file wp-content/themes/GDF_child/functions.php.
    Now seems it working fine, the recurring event “Burning Man” displayed as a single in home page “Upcoming Events” widget.

    Let us know.
    Thanks

    #242871

    Steve
    Full Member
    Post count: 1019

    Thank you. And to confirm. This is not “just for Burning Man” but for all recurring events? May I now turn back on the recurring events function and not have this happen with other recurring events? Kind regard and much appreciation.

    #242908

    Kiran
    Moderator
    Post count: 7069

    Hi,
    The function will work for all recurring events.
    If you want to turn back original events displaying & want to remove displaying single event instead of all recurring events then you can do it by two ways.

    Either by using PHP comment for the code from line no. 23 – 33
    OR
    By removing code from line no. 23 – 33

    The code will be found in the file wp-content/themes/GDF_child/functions.php

    Thanks for letting us know.

Viewing 14 posts - 1 through 14 (of 14 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket