gjunkie Posted November 26, 2009 Share Posted November 26, 2009 So I've got this function going in wordpress: function new_post_badge(){ if ( (time()-get_the_time('U')) < (1*86400) ) { // The number 1 is the number of days echo '<div class="todaysevent"></div>'; } } It works a little weird. The 86400 is the seconds. Basically what I want it to do is echo a div class if the post date/time of a blog post is less than 24hrs. What this is doing tho is echoing the div for every post dated past the current date... its an events site, so posts are dated in the future. All posts dated older than the current date don't echo it. I'm obviously doing something wrong. Any ideas? Link to comment https://forums.phpfreaks.com/topic/183041-help-echo-div-on-specific-date/ Share on other sites More sharing options...
FaT3oYCG Posted November 26, 2009 Share Posted November 26, 2009 the day you compare to needs to be static and you need to pull the post information from a database which will hold a time stamp of when it was posted and then compare the timestamp to the day that you need to compare to, in this case, the current day. Link to comment https://forums.phpfreaks.com/topic/183041-help-echo-div-on-specific-date/#findComment-966031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.