Articles of timestamp

How to use Internationalized human_time_diff() function in Chinese?

Looking at I’m using an English version of WordPress. In my theme template, I would like to define custom text of min, hour, day, week, month, year in Chinese using human_time_diff() when looping through posts. According to the instruction in the Codex documentation: <?php printf( _x( ‘%s ago’, ‘%s = human-readable time difference’, ‘your-text-domain’ […]

How to show different timestamp

I would like to show published time “Posted 4:15pm” for the first 24 hours, after 24hours show full published date and time “September 27, 2016 at 4:15pm” Any suggestions? Thanks in advance

Function Reference/human time diff for future posts

Right now I’ve got future posts displayed on my site, and I was using this code on each post to show when it was published. <?php echo human_time_diff( get_the_time(‘U’), current_time(‘timestamp’) ) . ‘ ago’; ?> Naturally it shows a post 2 days from now as 2 days ago. How might I fix it so it […]

Why am I seeing 'true' next to these timestamps?

Click on the Beers tab on this page: UPDATE: Here is the Pastebin for Excerpt.php. Note that excerpt.php is called in other places on the site (like the home page and the first tab on the link above and no ‘true’ appears.) Here’s the code: <div class=”ui-tabs-panel ui-widget-content ui-corner-bottom” id=”tabs-2″> <?php $post_obj = $wp_query->get_queried_object(); […]

Human time difference in months instead of days. How?

I use the following code in my template. <?php echo human_time_diff(get_the_time(‘U’), current_time(‘timestamp’)) . ‘ ago’; ?> It shows like 2 days ago, 20 days ago, 90 days ago. Is there a way to show 1 week ago instead of 7 days ago, 1 month ago instead of 30 days ago, 1 year ago instead of […]

datetime picker, timestamps and meta queries

I have a custom meta box with a datepicker. The datepicker outputs 2013-01-17 10:00 in my database for an event that is 01-17-2013 at 10pm PST. $eventlist = new WP_Query(array( ‘post_type’ => ‘events’, ‘posts_per_page’ => 5, ‘order’ => ‘asc’, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘datetime’, ‘meta_query’ => array( array( ‘key’ => ‘datetime’, // Check the […]

Where does the time get pulled from in the_time()

I am currently using the following function in my footer <?php the_time( ‘Y’ ); ?> But the footer keeps showing 2011, instead of 2013. So where does this time stamp get called from exactly?

Update File Once Every 30 Days

I’m building a plugin that requires a database file which is updated monthly. I would like to write a function that automatically replaces the old file once every 30 days. Here’s what I have so far. Am I on the right track? add_action( ‘plugins_loaded’, ‘update_some_file’ ); function update_some_file() { $remotefile = curl_init(‘’); curl_setopt($remotefile, CURLOPT_NOBODY, true); […]

How to allow registered users to submit the form only 5 times per day?

Question Is there a way that my registered users (if they are not the form is hidden so I don’t need that) are restricted to submit the form more than 5 times per day, or 20 per month or whatever value I would use? And I would also need to display the number of sumbmissions […]

Time & Date on Post – Time Ago Custom Function

I’m using the following custom function to display the timestamp for a post as posted “X minutes ago” or “X days ago” for 14 days and then this changes to the actual date (e.g. 17th December 2010): add_filter(‘the_time’, ‘dynamictime’); function dynamictime() { global $post; $date = $post->post_date; $time = get_post_time(‘G’, true, $post); $mytime = time() […]