Change the default meridiem displays for am and pm

Home Forums Calendar Products Events Calendar PRO Change the default meridiem displays for am and pm

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #955793
    webmasterena
    Participant

    We wish to alter the default display of “am” and “pm” to “A.M.” and “P.M.” for every instance of time in our calendar.

    I am unable to locate where to make this change within any of the Events Calendar plugin files.

    Here is our website calendar: http://www.ena.com/calendar/

    I want to make sure that every view and event page displays this format for the time related characters.

    I’m curious if anyone has attempted this customization before and can share their process.

    Thank you!

    ∂®ew

    #955866
    George
    Participant

    Hey Lillian,

    This is an interesting issue – there are indeed ways to make the date format only display uppercase meridians, like passing an uppercase ‘A’ to instance of the PHP date() function (whereas a lowercase ‘a’ in the function returns the lowercase ‘am’ and ‘pm’). We use this uppercase ‘A’ in almost all cases in our code, in fact, but on the front-end, as far as I’ve been able to tell here, it will take a little bit of extra code to ensure that meridians are uppercase (and, in your case, have the periods where appropriate).

    Try adding the following code to your theme’s functions.php file:

    
    if ( function_exists( 'tribe_is_event' ) ) {
    	/**
    	 * Ensure that front-end meridians display in uppercase.
    	 * @link http://theeventscalendar.com/support/forums/topic/change-the-default-meridiem-displays-for-am-and-pm/
    	 */
    	function tribe_enforce_uppercase_meridians( $schedule ) {
    		return preg_replace( array( ' /am/', ' /pm/' ), array( ' A.M.', ' P.M.' ), $schedule );
    	}
    	add_filter( 'tribe_events_event_schedule_details', 'tribe_enforce_uppercase_meridians' );
    }
    

    I tested this on my local site and worked really well, so hopefully it does for you too – let us know! 🙂

    Thanks!
    George

    #960963
    webmasterena
    Participant

    Thank you George for your assistance. I used the code you provided in my functions.php file and things broke in our test environment. This won’t be a solution we can use on our public and seems to break due our theme. We may need to hold out until we roll out a new theme for our website unless you have another suggestion to try.

    #961779
    George
    Participant

    Hey Lillian,

    The code I shared above did work fine for me on my site, so I’m curious about other problems on your site that prevented the code from working correctly – the only further step I can think of here would be for you to share your whole functions.php with me directly, so I could review how you’ve added that custom code above – perhaps you’ve left a <?php bracket left open or something, or accidentally left one of the { braces open.

    To do that, just copy your version of the functions.php file with the code that I shared above added to it to a Gist at http://gist.github.com, and then share a link here to that published Gist. We can look at your code and see if anything is wrong there.

    If not, then the failure of the custom code would likely mean that there are therefore other plugin or theme conflicts on your site.

    Let us know if you’d like to go down this road of further inspection here, or would rather do what you mentioned near the end of your post above and just wait for the next official updates.

    Thanks!
    George

    #984150
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Change the default meridiem displays for am and pm’ is closed to new replies.