a4270407 by Jeff Balicki

date

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 141e18fd
...@@ -257,4 +257,31 @@ if ( ! function_exists( 'understrap_all_excerpts_get_more_link' ) ) { ...@@ -257,4 +257,31 @@ if ( ! function_exists( 'understrap_all_excerpts_get_more_link' ) ) {
257 } 257 }
258 } 258 }
259 259
260 add_filter( 'excerpt_length', function( $length ) { return 35; } );
...\ No newline at end of file ...\ No newline at end of file
260 add_filter( 'excerpt_length', function( $length ) { return 35; } );
261
262 function wpmldp_translate_date_format( $date ) {
263
264 //Create array with dates
265 $month_dates = array();
266 $month_dates[] = '1st';
267 $month_dates[] = '2nd';
268 $month_dates[] = '3rd';
269 for($d=4; $d<=30; $d++) {
270 $month_dates[] = $d.'th';
271 }
272 $month_dates[] = '31st';
273
274 //Register strings on String Translator
275 foreach( $month_dates as $month_date ) {
276 do_action( 'wpml_register_single_string', 'Date Formats', 'Month Date (WPML) - '.$month_date, $month_date);
277 }
278
279 //Translate strings
280 if( in_array($date, $month_dates) ) {
281 $date = apply_filters( 'wpml_translate_single_string', $date, 'Date Formats', 'Month Date (WPML) - '.$date);
282 }
283
284
285 return $date;
286 }
287 add_filter( 'wp_date', 'wpmldp_translate_date_format', 10, 1 );
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -60,8 +60,8 @@ function pull_posts_for_post_list( $data ) { ...@@ -60,8 +60,8 @@ function pull_posts_for_post_list( $data ) {
60 if(!$img) { 60 if(!$img) {
61 $img = get_post_meta($post->ID, 'photo_from_source', true); 61 $img = get_post_meta($post->ID, 'photo_from_source', true);
62 } 62 }
63 error_log($excerpt); 63
64 $new_posts[] = ['date'=>get_the_time( ' F j, Y', $post), 64 $new_posts[] = ['date'=>wp_date( ' F j, Y', get_post_timestamp($post->ID)),
65 'article_author'=>$article_author,'author_title'=>$author_title, 65 'article_author'=>$article_author,'author_title'=>$author_title,
66 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title, 66 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title,
67 'text'=>$excerpt,'img_src'=>$img]; 67 'text'=>$excerpt,'img_src'=>$img];
...@@ -116,7 +116,7 @@ function pull_posts_for_post_list( $data ) { ...@@ -116,7 +116,7 @@ function pull_posts_for_post_list( $data ) {
116 if(!$img) { 116 if(!$img) {
117 $img = get_post_meta($post->ID, 'photo_from_source', true); 117 $img = get_post_meta($post->ID, 'photo_from_source', true);
118 } 118 }
119 $posts[] = ['date'=>get_the_time( ' F j, Y', $post), 119 $posts[] = ['date'=>wp_date( ' F j, Y', get_post_timestamp($post->ID)),
120 'article_author'=>$article_author,'author_title'=>$author_title, 120 'article_author'=>$article_author,'author_title'=>$author_title,
121 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title, 121 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title,
122 'text'=>$excerpt,'img_src'=>$img]; 122 'text'=>$excerpt,'img_src'=>$img];
......