Events with start time but no end time

Home Forums Calendar Products Events Calendar PRO Events with start time but no end time

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1023045
    Adage
    Participant

    Hello,
    I have want to set events that have only a starting time, and no ending time ; how should I manage to do this ?
    Thank you.

    #1023355
    Barry
    Member

    Hi Adage,

    If you create an event and leave the end date/time alone (basically, so that it matches the start date/time) then it should have the effect you’re looking for 🙂

    Does that help?

    #1023390
    Adage
    Participant

    Just great ! Thank you !

    #1023393
    Adage
    Participant

    Just one more question : is it possible to show only the hours, and not the minutes ?
    Like “next event today at 10h”
    Thank you.

    #1023439
    Barry
    Member

    Hi Adage,

    By default the plugin simply uses the time format set up in WordPress’s Settings → General admin screen.

    Changing this will however change the time format everywhere, which may not be your goal. The alternative is to customize things using the tribe_events_event_schedule_details_inner hook. Basic example:

    function custom_event_schedule_format( $unused, $event_id ) {
        return tribe_get_start_date( $event_id, false, 'Y-m-d: h' ) . 'h';
    }
    
    add_filter( 'tribe_events_event_schedule_details_inner', 'custom_event_schedule_format', 10, 2 );

    Of course, that’s a really simple example and you’d almost certainly want to tweak it to preserve the sort of date formatting you desire, but it should at least serve to outline the basic approach used to solve this sort of customization issue 🙂

    #1023441
    Barry
    Member

    (… Just to clarify, you would place that code either in your theme’s functions.php file or else in a custom plugin or some other suitable place 🙂 )

    #1023600
    Adage
    Participant

    Hello and thank you,
    In deed I need to custom the function.
    Could you please show me where I can have more details on how to customise it ?
    Thank you.

    #1023717
    Barry
    Member

    Hi Adage,

    To understand date formats (such as what things like Y-m-d: h mean), please refer to the PHP manual – we’re using the same conventions.

    Beyond that I’m afraid we have no specific resources on this, though you could certainly refer to our own code used for building the date/time (or “schedule”) information for each event, which can be found here:

    The Events Calendar repo: tribe_events_event_schedule_details()

    You could certainly reuse as much of that logic as you choose. I hope that helps 🙂

    #1024265
    Adage
    Participant

    Just perfect ! Thank you very much !

    #1024389
    Barry
    Member

    Happy to help 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Events with start time but no end time’ is closed to new replies.