How would I bulk change posting date?
Post date/time can’t be changed via the Quick-Edit bulk editor. You might edit the SQL directly, if you’re comfortable running a query in PHPMyAdmin. Or, you could search for a Plugin?
Post date/time can’t be changed via the Quick-Edit bulk editor. You might edit the SQL directly, if you’re comfortable running a query in PHPMyAdmin. Or, you could search for a Plugin?
Try the date_diff() / DateTime::diff() function in PHP: // Object-oriented style. $datetime1 = new DateTime( $post->post_date ); $datetime2 = new DateTime(); // current date $interval = $datetime1->diff( $datetime2 ); echo $interval->format( ‘%a days old’ ); // .. or procedural style. $datetime1 = date_create( $post->post_date ); $datetime2 = date_create(); // current date $interval = date_diff( $datetime1, … Read more
You should store the time as a unix time stamp then you can use human_time_diff to compare. echo human_time_diff( get_the_time(‘U’), current_time(‘timestamp’) ); If the difference is more than 24 hours difference it will return the value in days.
You would just need to format the time that is returned by current_time() with the php date() function like this: $my_time = date(‘G’, current_time(‘timestamp’)); The param ‘G’ tells the function you just want to have the hour part (0 to 23) of the date. Have a look here: http://www.php.net/manual/en/function.date.php
WordPress essentially completely ignores native PHP date functionality, in favor of its own handling. That traditionally allowed it to manage related aspects (such as timezones and translation) with no regards for server configuration. My educated guess that it would be largely oblivious to such change. At most the cron tasks might fire in bulk and … Read more
You’d have to specify day, month, and year to get today’s posts: $my_query = new WP_Query( array( ‘cat’=>1, ‘year’=>date(‘Y’), ‘monthnum’=>date(‘m’), ‘day’=>date(‘d’), ‘posts_per_page’=>-1 ) ); Leaving day blank just doesn’t set that query var, so its not restricting your query at all.
http://codex.wordpress.org/Function_Reference/get_gmt_from_date Replace all instances of get_the_date or the_date with echo get_gmt_from_date(get_the_date(‘Y-m-d H:i:s’)). That’s not a quick fix, it’s a way to fix your sitemaps. EDIT: WordPress SEO runs it’s raw dates from MySQL through a WP function called mysql2date, which in turn calls date_i18n. date_i18n happens to have a handy filter which you can tie … Read more
Although, in my wp your echo displayed correctly (so maybe double check that you use the correct locale and that “decline months names: on or off” is translated as “on” in your locale), you can “force” genitive case, by making a generic wrap function based on the wp_maybe_decline_date(). I have tested and used this, in … Read more
Unix time is defined as the amount of seconds since the “Unix epoch,” which is 00:00:00 UTC on 1 January 1970. It works both forwards and backwards — so technically you shouldn’t have trouble representing dates all the way back to Jan. 1, year 1, but the numbers would be negative and extremely large. EDIT: … Read more
echo date(‘Y-m-d h:i:s’, strtotime($cp->post_date)); … or better use the wordpress functionado echo mysql2date(‘Y-m-d h:i:s’, $cp->post_date);