Question

We display event dates/times via Wordpress date and time functions in am/pm time (12 hour, not 24 hour). For any times that are noon - i.e. "12:00 pm" - we'd like to display "12:00 noon" instead.

And we'd also like to display "12:00 midnight" instead of "12:00 am".

This is to avoid confusion (we run online events around the world at different times so there is room for this type of confusion).

All other times of the day can keep their am/pm, it's just these two exact times that we're seeking to change.

Was it helpful?

Solution

So what you need to do is make your life easier and instead of searching everything within every instance of .pp-post-content or .pp-post-content p, let's wrap the times or the times in question with a span tag. Like you suggested in your comments <span class="tas-event-time"> is sufficient enough.

Now, in your .js file, you want to add the following:

jQuery( document ).ready( function($) {
    $( '.tas-event-time' ).html( $( '.tas-event-time' ).html().replace( '12:00 pm','12:00 noon') );
} );

That will, once the document is ready, change the instances of '12:00 pm' to '12:00 noon'.

OTHER TIPS

I think you can Do it with Translation loops! Simply find the "12:00 pm" and put 12:00 Noon. Maybe It works! try it :D.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top