Modifying Date/Time format in Widget List View

Home Forums Calendar Products Events Calendar PRO Modifying Date/Time format in Widget List View

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1303840
    David
    Participant

    Currently the list view in EC PRO shows the Date/Time icon using the abbreviation and number for the day (ex. FRI 30)

    I would like it to display the month day and year in the F j, Y format (ex. July 4, 2017)

    I am having difficulty locating the template (or method) to complete this customization. I have gone through many of the template files and used the Themer’s Guide but so far no luck.

    I was hoping you might assist and point me in the right direction.

    Thanks in advance!

    Dave

    #1310101
    Barry
    Member

    Hi Dave,

    Thanks for posting and our apologies for the delay in responding.

    The first thing to do here is check out the Date Format Settings found in the Events → Settings → Display screen: if tweaking these doesn’t help then we’ll need to take another look — and if you could share your domain (by private reply if you prefer) that might help us to gather some insights into the problem.

    Let me know how you get on 🙂

    #1310114
    Barry
    Member

    Hi again Dave,

    I unfortunately missed that you were referencing the list widget. To change the date format used here, you would need to adjust the following template from Events Calendar PRO:

    views/pro/widgets/modules/single-event.php

    Following the steps described here please copy this to your theme and make the changes there:

    YOUR_THEME/tribe-events/pro/widgets/modules/single-event.php

    The section of code you are looking for is the <div class=”list-date”> section, and you can simplify that down to use whatever format you prefer.

    Does that help? Let me know if you need any further direction!

    #1316641
    David
    Participant

    This reply is private.

    #1316645
    David
    Participant

    The styling is the easy part but I need to get the year in there so I can format it like the attached screenshot from the design comp. It looks like the title and city/state info can be handled directly in the short code correct?

    #1317030
    Barry
    Member

    OK – were you able to setup a template override like I outlined in my last reply?

    #1317035
    David
    Participant

    Hi Barry – Yes I was able to set up the override. The issue I am having is implementing the proper PHP in order to have the year included with the date/time structure as it is currently set up.

    • This reply was modified 6 years, 9 months ago by David.
    #1317071
    Barry
    Member

    Gotcha.

    Well, in that template, you will see code like this:

    <div class="list-date">
    		<?php
    		if (
    			isset( $instance['tribe_is_list_widget'] )
    			&& date( 'm', $post_date ) != date( 'm', current_time( 'timestamp' ) )
    		) :
    			?>
    			<span class="list-dayname">
    				<?php
    				echo apply_filters(
    					'tribe-mini_helper_tribe_events_ajax_list_dayname',
    					date_i18n( 'M', $post_date ),
    					$post_date,
    					$mini_cal_event_atts['class']
    				);
    				?>
    			</span>
    		<?php else: ?>
    			<span class="list-dayname">
    				<?php
    				echo apply_filters(
    					'tribe-mini_helper_tribe_events_ajax_list_dayname',
    					date_i18n( 'D', $post_date ),
    					$post_date,
    					$mini_cal_event_atts['class']
    				);
    				?>
    			</span>
    		<?php endif; ?>
    
    		<span class="list-daynumber"><?php echo apply_filters( 'tribe-mini_helper_tribe_events_ajax_list_daynumber',
    			date_i18n( 'd', $post_date ), $post_date, $mini_cal_event_atts['class'] ); ?></span>
    		</div>

    Try changing it to this (which is much shorter):

    <div class="list-date">
    	<?php echo tribe_get_start_date( $post_id, false, 'M j, Y' ); ?>
    </div>

    That help?

    #1317782
    David
    Participant

    Hi Barry,

    Thanks that did the trick! I really appreciate the clear and direct help on this ticket…very much appreciated.

    Have a great weekend.

    Dave

    #1318632
    Barry
    Member

    Excellent!

    #1328857
    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 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Modifying Date/Time format in Widget List View’ is closed to new replies.