How Dates Appear
-
Can anyone help me please with functions.php
I am using an Events plugin, and a developer kindly updated the dates for me to show 1st, 2nd … etc
All is fine apart from 11st, 12nd, 13rd
All other numbers – including 21st, 22nd, 23rd, 31st – show correctlyThis is the php used, is there another line I can add to correct 11st, 12nd, 13rd
Thank you
// Event Date Time Format if( isset( $event['enddate_info'] ) ) { $event_date_time = $event['timespan_short']; $event_date_time = explode( ' @ ', $event_date_time ); if( count( $event_date_time ) > 1 ) { $day = $event['enddate_info']['day']; $day_last_digit = substr( trim( $day ), -1 ); switch( $day_last_digit ) { case '1': $day .= 'st'; break; case '2': $day .= 'nd'; break; case '3': $day .= 'rd'; break; default: $day .= 'th'; } $event_date_time[0] = $event['enddate_info']['weekday'] . ' ' . $day . ' ' . $event['enddate_info']['month']; } $event_date_time = implode( ' @ ', $event_date_time ); $event['timespan_short'] = $event_date_time; } } } } return $args; } add_filter( 'ai1ec_theme_args_stream.twig', 'ls_stream_args', 10, 2 );[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘How Dates Appear’ is closed to new replies.