help with time of day
-
hello–
im attempting to run an old plugin. i tried using the regular call for time
<?php the_time('M Y') ?>
and it works, however, every post says “in the wee hours”…. any ideas? i assume it is not up to date for 2.9.1. if anyone could offer any advice on how to make it work i would sincerely appreciate it.function time_of_day($content) { //$pdate = strtotime($content); $pdate = strtotime(str_replace("<br />","",$content)); //WP-Admin adds a break tag for display purposes which we have to strip out. $hour=date('H',$pdate); switch($hour) { case 0: case 1: case 2: $tod = 'in the wee hours'; break; case 3: case 4: case 5: case 6: $tod = 'terribly early in the morning'; break; case 7: case 8: case 9: $tod = 'in the early morning'; break; case 10: $tod = 'mid-morning'; break; case 11: $tod = 'just before lunchtime'; break; case 12: case 13: $tod = 'around lunchtime'; break; case 14: $tod = 'in the early afternoon'; break; case 15: case 16: $tod = 'mid-afternoon'; break; case 17: $tod = 'in the late afternoon'; break; case 18: case 19: $tod = 'in the early evening'; break; case 20: case 21: $tod = 'at around evening time'; break; case 22: $tod = 'in the late evening'; break; case 23: $tod = 'late at night'; break; default: $tod = ''; break; } return $tod; } add_filter('the_time','time_of_day'); ?>
i am using this in the loop
<?php time_of_day(abs(strtotime($post->post_date)));?>
thank you again
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘help with time of day’ is closed to new replies.