Remove year from function tribe_events_list_the_date_headers()

Home Forums Calendar Products Events Calendar PRO Remove year from function tribe_events_list_the_date_headers()

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1433315
    oxygengraphics
    Participant

    I’m trying to customise the events pro calendar and understand that I can’t edit the files within /template-tags directly.

    I’m hoping if you can help me with this I should be able to do further customisations.

    Below is the function I want to modify and I simply want to remove the year from coming out of the header.

    What would I put into my functions.php in order to do this?

    function tribe_events_list_the_date_headers() {

        /* Month and year separators (on every month and year change) */
    
        $show_headers = apply_filters( 'tribe_events_list_show_date_headers', true );
    
        $html = '';
    
        if ( $show_headers ) {
    
            global $post, $wp_query;
    
            $event_year        = tribe_get_start_date( $post, false, 'Y' );
            $event_month       = tribe_get_start_date( $post, false, 'm' );
            $month_year_format = tribe_get_date_option( 'monthAndYearFormat', 'F Y' );
    
            if ( $wp_query->current_post > 0 ) {
                $prev_post = $wp_query->posts[ $wp_query->current_post - 1 ];
                $prev_event_year = tribe_get_start_date( $prev_post, false, 'Y' );
                $prev_event_month = tribe_get_start_date( $prev_post, false, 'm' );
            }
    
    
            /*
             * If the event month changed since the last event in the loop,
             * or is the same month but the year changed.
             *
             */
            if ( $wp_query->current_post === 0 || ( $prev_event_month != $event_month || ( $prev_event_month == $event_month && $prev_event_year != $event_year ) ) ) {
                $html .= sprintf( "<span class='tribe-events-list-separator-month'><span>%s</span></span>", tribe_get_start_date( $post, false, $month_year_format ) );
            }
    
            echo apply_filters( 'tribe_events_list_the_date_headers', $html, $event_year );
        }
    }
    
    #1434313
    Cliff
    Member

    Hi. Are you wanting to hide the Year sitewide or only within these headers?

    #1453076
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Remove year from function tribe_events_list_the_date_headers()’ is closed to new replies.