Remove Event Times only

Home Forums Calendar Products Events Calendar PRO Remove Event Times only

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #487663
    Philip Murray
    Participant

    hi Guys

    I bought the Events Calendar PRO and am having problems sorting out this specific request

    I want the TIME not to be displayed for any event whether it is shown in the CALENDAR WIDGET or in the main Calendar page.
    i added this class to my CSS
    .tribe-events-abbr.updated.published.dtstart { display: none; }
    but it removed the DATE as well as the TIME !!! so i removed the class again.

    if you look at http://www.fingerprintdigitalmedia.com/beaverstown/ the widget is in the right column. The Events are shown, each with a start time of 12am – which i want to either REMOVE or HIDE.
    i want to keep the dates in but have the TIME removed

    similarly on the Event Detail pages:
    http://www.fingerprintdigitalmedia.com/beaverstown/events/junior-comp-800-1100-9-hole-invitational-500-700-6/

    i want the TIME to be removed or HIDDEN

    how do i do this in the CSS please?

    thanks

    Phil

    #497548
    Barry
    Member

    Hi Phil, thanks for contacting us.

    if you look at http://www.fingerprintdigitalmedia.com/beaverstown/ the widget is in the right column. The Events are shown, each with a start time of 12am – which i want to either REMOVE or HIDE.
    i want to keep the dates in but have the TIME removed

    It looks like you’ve already resolved this part of the problem, is that correct?

    similarly on the Event Detail pages:
    http://www.fingerprintdigitalmedia.com/beaverstown/events/junior-comp-800-1100-9-hole-invitational-500-700-6/

    i want the TIME to be removed or HIDDEN

    Again it looks like you have already achieved this – at least in one place – but I see the start time is still displaying within the meta section the area headlined Details, within a grey box. Do you also wish to remove that entry?

    Thanks!

    #498237
    Philip Murray
    Participant

    hi Barry

    yes – the problem resolved it for the CALENDAR WIDGET by adding this to the CSS:

    .date-start.dtstart {
    display:none !important;
    }

    however it is not resolved for the EVENTS PAGE

    this for example:
    http://www.fingerprintdigitalmedia.com/beaverstown/events/friday-night-mixed-9-hole-500-700-8/

    i tried adding this to the CSS:
    abbr.tribe-events-abbr.updated.published.dtstart {
    display:none !important;
    }

    but it removed both the DATE and the TIME — i only want the TIME to be removed completely [included the word Time: also]

    thanks

    Phil

    #505557
    Barry
    Member

    OK, thanks for clarifying. Let’s use a different approach (than CSS) to remove the time from the string at the top of the single event pages. Please add the following snippet to your theme’s functions.php file:

    add_filter( 'tribe_events_event_schedule_details', 'remove_schedule_details_time' );
    
    function remove_schedule_details_time( $dt_string ) {
    	// This approach relies on a fairly unique non-empty separator being set
    	$separator = tribe_get_option('dateTimeSeparator', ' @ ');
    	$split = strpos( $dt_string, $separator );
    
    	// If the split point can't be found, bail
    	if ( ! $split ) return $dt_string;
    
    	// Otherwise, return everything *up to* the split point
    	return substr( $dt_string, 0, ++$split );
    }

    This does assume that you’ve got a separator symbol such as @ set up, which is the default behaviour. To remove the time from the meta section below, please first read through our Themer’s Guide which covers the basics of safely overriding and customizing our templates.

    From there you will be interested in overriding the modules/meta/details.php template. Within your own copy locate this fairly lengthy section of code and reduce it to this (so your final custom template should basically look a bit like this).

    Does that help?

    #505674
    Philip Murray
    Participant

    Thanks a lot Barry – i will give it a try and report back

    Phil

    #526979
    Barry
    Member

    Awesome, look forward to hearing from you 🙂

    #616129
    Philip Murray
    Participant

    hi Barry

    ok i tried adding your script to functions.php without success

    here is a typical EVENT PAGE – the TIME is still visible
    http://www.beaverstown.com/event/club-competition-31/

    i want the date to remain but the time to not be shown at all

    the time is also visible on the main CALENDAR MONTH VIEW page
    http://www.beaverstown.com/events/

    any idea why it didn’t work?

    thanks
    Phil

    #618303
    Barry
    Member

    Interesting: can you confirm you put a template override in place (and let me know what it’s path is)? Could you also share the code you currently have within it?

    #621631
    Philip Murray
    Participant

    hi Barry – thanks – it’s the override that I am going wrong on — i have the PRO version — where do i find the modules/meta/details.php template ? i checked via FTP but what i see is a folder called /events-calendar-pro/views/pro/modules/meta/additional-fields.php

    thanks
    Phil

    #621730
    Philip Murray
    Participant

    hi Barry

    ok – i got it sorted – i needed to edit the details.php within the-events-calendar structure rather than the pro structure. So that is working fine now.

    but one more change needed – if you look at the MONTH VIEW page for the category – http://www.beaverstown.com/events/category/club-diary/
    if you hover over any event it shows the time of 12:00am in there — i need to remove that too please

    thanks
    Phil

    #631720
    Philip Murray
    Participant

    hi Barry

    as well as the point above – i have noticed another problem.
    if you look at my client site – http://www.beaverstown.com/
    in the right column i have shown the CALENDAR WIDGET — but if you select any of the dates which have a events in them – nothing gets shown below the calendar?

    any idea how to fix this?

    thanks
    Phil

    #638162
    Barry
    Member

    Hi Phil!

    if you hover over any event it shows the time of 12:00am in there — i need to remove that too please

    So you’re going to need a further template override in place – this time for month/single-event.php – and the basic idea is to modify the data that is passed across to the tooltip such that the start time is stripped out. I’m going to assume here that you still have the function I suggested in my earlier reply in place.

    Essentially, you need to add this code near the top of the file, but below the line reading global $post:

    $tooltip_data = json_decode( tribe_events_template_data( $post ) );
    $tooltip_data->startTime = remove_schedule_details_time( $tooltip_data->startTime );
    $tooltip_data = json_encode( $tooltip_data );

    Then, you need to find this short piece of code:

    data-tribejson='<?php echo tribe_events_template_data( $post ); ?>'

    Change this segment to:

    data-tribejson='<?php echo $tooltip_data ?>'

    (The complete custom template should basically look something like this.)

    as well as the point above – i have noticed another problem.
    if you look at my client site – http://www.beaverstown.com/
    in the right column i have shown the CALENDAR WIDGET — but if you select any of the dates which have a events in them – nothing gets shown below the calendar?

    We’re happy to help if we can – but we do try to stick to one issue per thread. If you don’t mind posting a new thread for this unrelated issue one of the team will be only too happy to help 🙂

    #638343
    Philip Murray
    Participant

    Thanks Barry – i will try this.

    i also posted the other query as a separate thread
    cheers
    Phil

    #638475
    Philip Murray
    Participant

    hi Barry

    that code worked perfectly — is there anyway I can get rid of the ‘@’ symbol too please – which is visible when you hover over an event in MONTH VIEW
    thanks
    Phil

    #641279
    Barry
    Member

    Hi Phil,

    I’m sorry that didn’t quite work for you. Interestingly, it does work for me and the @ symbol is removed. It might simply be that you need to tinker a little with the function I provided earlier to get the best results in your specific case – you might for instance want to increment or decrement the $split variable one or more times.

    Unfortunately, I think at this point we’ll have to leave it to you to iron out the last few details. Thanks again for posting and good luck with the rest of the customization (and one of the team will be along to help in the other thread you created) 🙂

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Remove Event Times only’ is closed to new replies.