I’ve found the code below that does what I want except it isn’t accurate to the hour. It is only accurate to the whole day, so if my post expires in the morning it still shows it as current in the afternoon.
How would this be able to be more accurate to the hour?
<?php if (strtotime($post->post_date) > strtotime('+1 minute')): ?>
<p>current</p>
<?php elseif (strtotime($post->post_date) > strtotime('-999999999 days')) : ?>
<p>expired</>
<?php else : ?>
<?php endif; ?>
Related Posts:
- the_modified_date returns published date
- Set the publication date independent of the scheduled publication date
- Sort / display recent posts by publish date
- How to add published date in product [closed]
- Post publish date [duplicate]
- check if a draft has been moved there from publish to draft
- How do I use PHP to get the current year?
- R Programming Error in cov.wt(z) : ‘x’ must contain finite values only
- Convert a Unix timestamp to time in JavaScript
- How can I delay the publishing of a page or post?
- Unable to select an old date in wordpress
- How to get date for each post?
- How to prevent posts from being published too close to each other?
- Is it possible to Schedule Attachments in WordPress?
- Permitting WordPress to accept dates outside of 1902-2038
- Keeping post_date same as the pending post_date on privately publishing the post
- Date comparison : which date format?
- featuring old articles without messing up with the archive
- XML export posts from one single day
- Bulk edit post date in wordpress
- Serve visitor post time adjusted to their timezone
- Automatically move pending posts after 30 days and, update the post date, when users update the posts
- month name translation
- Count days from registration date to today
- Scheduled Posts and wp-cron – Why don’t scheduled posts publish if too old?
- How can I display a specific user’s first published post?
- Remove “at” string from wordpress comment date
- Page Revision date displaying on google search
- Change date from 2015/02/23 to “1 min ago”
- Display page only if user registered before a specific date
- Date and time format for UK in a custom post type [closed]
- Display post date as 04/26/2013
- What are the “U” and “G” time formats?
- date() returns incorrect value if used from WordPress theme, but correct otherwise
- Add a link to display posts with a specific tag within a date range
- About Time conditionals
- After wp_insert_post(), date_i18n() and date() outputs are adjusted to GMT
- Mini app that shows one unique quote each day. 56 rotating posts rotating for each themed weekday. It works, but I need your advice
- How to add a sortable date column in an admin page?
- How to switch wordpress post status between publish and schedule in MySQL?
- Do multiple jobs on date change without WordPress cron job
- Wrong date returned by get_the_time
- Get_the_date doesnt show todays date [closed]
- How replace post date with event date
- Translate current_time
- Conditional: IF post creation date is in the first half OR last half of the year [closed]
- Display published time for today’s posts only
- Return date in French
- convert time to WordPress user’s local time
- How to restrict an author scheduling their post date to a maximum X days ahead from the current date
- How do I publish portfolio items with a future date?
- Change post date for testing purposes
- Local Post Date in WordPress Admin Panel Tables
- How to add publish date in the title
- Date Language doesn’t change
- display future posts in date page
- how to show date of latest post in wordpress site?
- Post: how to set created date after post has been published [closed]
- Month display in English but required in Swedish?
- Show different time stamp based on time
- Change News Story Layout Based on Date Range
- Update post date of page when Visitor access that page?
- date format of custom date variable
- Check if is Post or Comment
- Create a date archives template page for custom post type
- changing type of date picker in contact form 7 date picker plugin
- If X Amount of Time Has Passed Since Post Was Published, Do Something
- Not work hide comments with future date
- Translate Post date (month) of china language
- I want to format my Post dates differently to other dates on my website
- How to display posts categori list by day wordpres
- Update existing post times to random times?
- Tumblr imported blog showing wrong date
- Timezone for Plugin
- How to hide post published date?
- Create blog post from external source and set publication date
- How to display Date and Time in Tamil Language?
- Create a new post on a specified publish date via link?
- Get current week’s day and time outside the loop
- Notify after 3,6,9 and then 12 months after plugin activation
- Issue with strtotime() and Meta Box date
- Is it normal for a scheduled post to say “Missed Schedule”
- Use the_date with link
- Show post date on the page
- automatic send email at custom time
- Change the date and time in wordpress
- How to second orderby in “pre_get_posts” by meta value or combine single date and time to timestamp
- Set Custom Date for Posts
- Posted date format not reflected
- Make datestamp for status updates show time
- Date comparison : which date format?
- Force Publish Future (Scheduled) Posts Immediately [duplicate]
- Saving Revision of post meta key/value on each update_post_meta event
- Get system timestamp in wordpress
- Limit access to a page
- Retrieve current and localized month
- Output the published date / last modified date of specific page
- In my Website homepage I want to remove date which is written along author name [closed]
- get_the_date() return always UTC+0 [duplicate]
- How to customize Date Format for American visitors?