Automatically move pending posts after 30 days and, update the post date, when users update the posts
Automatically move pending posts after 30 days and, update the post date, when users update the posts
Automatically move pending posts after 30 days and, update the post date, when users update the posts
Serve visitor post time adjusted to their timezone
Original source : post date Create admin-script.js at your current theme ( this use js folder ) jQuery(document).ready(function($){ $(‘.inline-edit-col-right .inline-edit-col’) .append( ‘<label style=”margin-top: 3em;”><span class=”title”>Date</span>’ + ‘<div class=”timestamp-wrap”><select name=”mm”>’ + ‘<option value=”00″>Month</option>’ + ‘<option value=”01″>01-January</option>’ + ‘<option value=”02″>02-February</option>’ + ‘<option value=”03″>03-March</option>’ + ‘<option value=”04″>04-April</option>’ + ‘<option value=”05″>05-May</option>’ + ‘<option value=”06″>06-June</option>’ + ‘<option value=”07″>07-July</option>’ + ‘<option … Read more
Enhance the native XML export – with a single day selection Here’s one way to modify the native export with a select box, with all available days: Here we assume that there are not “huge” number of days to select from 😉 Otherwise we could use a different kind of user interface. Step #1 First … Read more
WordPress has a special function for translating dates, called date_i18n. General usage: echo date_i18n( $dateformatstring, $unixtimestamp, $gmt); Supposing you have German as your site’s language this would be: echo date_i18n( ‘j. F Y’, false, false); You can also import the time format from the admin settings, like this: echo date_i18n(get_option(‘date_format’), false, false);
The date format for entering the date is largely irrelevant. strtotime will convert a lot of different formats to UNIX time. Just make sure your input format makes sense to your users and make sure that your feed strtottime a format that correctly converts to UNIX time. If you are storing data in the *_postmeta … Read more
@Howdy_McGee is on the right track in his comment: by the time transition_post_status is fired, the post has already been updated (i.e., written to the db). What you need to do is hook into wp_insert_post_data, instead of transition_post_status, as follows: add_filter (‘wp_insert_post_data’, ‘mycpt_keep_pending_date_on_publishing’, 10, 2) ; function mycpt_keep_pending_date_on_publishing ($data, $postarr) { if ($data[‘post_type’] != ‘mycpt’) … Read more
You should use date_i18n(): $timestamp = get_post_meta($post_to_edit->ID, ‘_single_date’, true); $friendly_date = date_i18n( get_option(‘date_format’), $timestamp ); ?><input value=”<?= $friendly_date ?>” name=”_single_date” />
Yes, as you – so far – have no publish date. You could use $post->post_modified, which will always be the date of the latest modification to the post data. Debug: Try hooking into the filter and dump both vars: function date_dump_callback( $date, $d ) { echo ‘<pre>’; print_r( $date ); print_r( $d ); echo ‘</pre>’; … Read more
Hacking the core is never recommended, since you’ll have to reapply your hack every time you update (and for a number of other reasons). The first thing I would normally do is to check if there is a hook or filter to allow you to modify the date. It doesn’t appear there is one. The … Read more