error

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1047948
    Jan
    Participant

    Hi,

    I need you to correct this function:

    /*
    * Adds start time to event titles in Month view
    */
    function tribe_add_start_time_to_event_title ( $post_title, $post_id ) {

    if ( !tribe_is_event($post_id) ) return $post_title;
    // Checks if it is the month view, modify this line to apply to more views
    if ( !tribe_is_month() ) return $post_title;

    $event_start_time = tribe_get_start_time( $post_id );

    if ( !empty( $event_start_time ) ) {
    $post_title = $event_start_time . ‘ – ‘ . $post_title;
    }

    return $post_title;
    }
    add_filter( ‘the_title’, ‘tribe_add_start_time_to_event_title’, 100, 2 );

    , which you send me, now after update to events calendar pro 4, I have this error in admin panel:

    Warning: Missing argument 2 for tribe_add_start_time_to_event_title() in

    Thank you

    #1049982
    Geoff
    Member

    Hi Jan,

    I’m not seeing the same error for some reason, but you could remove the second argument from the function since that seems to be what’s causing it:

    /*
    * Adds start time to event titles in Month view
    */
    function tribe_add_start_time_to_event_title ( $post_title ) {
    
    if ( !tribe_is_event($post_id) ) return $post_title;
    
    // Checks if it is the month view, modify this line to apply to more views
    if ( !tribe_is_month() ) return $post_title;
    
    $event_start_time = tribe_get_start_time( $post_id );
    
    if ( !empty( $event_start_time ) ) {
    $post_title = $event_start_time . ' – ' . $post_title;
    }
    
    return $post_title;
    }
    
    add_filter( 'the_title', 'tribe_add_start_time_to_event_title', 100, 2 );

    Cheers!
    Geoff

    #1076446
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘error’ is closed to new replies.