• Resolved kevkong1

    (@kevkong1)


    I’ve found a few date questions on this forum but no answer to this. I want to change the date format to remove any “st” | “nd” | “rd” | “th” for the dates in a production list. Example below would be to remove the th from the date:

    Date(s): until 9th July 2018

    I’m using the shortcode below:

    [wpt_productions]{{dates}}[/wpt_productions]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeroen Schmit

    (@slimndap)

    The easiest way is to change the date format setting in WordPress:

    Settings -> General -> Date format

    but this with change the format site wide.

    Another option is to use a little bit of code in the functions.php of your (child)theme:

    function change_startdate_format( $startdate, $event ) {
      $startdate_datetime = $event->datetime();
      $startdate_datetime += ( get_option( 'gmt_offset' ) * 3600 );
      $startdate_datetime -= Theater_Helpers_Time::get_next_day_start_time_offset();
      return date_i18n( 'd F Y', $startdate_datetime);
    }
    
    add_filter( 'wpt/event/startdate', 'change_startdate_format', 10, 2 );
    • This reply was modified 7 years, 11 months ago by Jeroen Schmit.
    Thread Starter kevkong1

    (@kevkong1)

    Awesome man worked perfect!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove th, nd, rd, st from date’ is closed to new replies.