原始来源:post date
创建admin-script.js 在您当前的主题中(使用js文件夹)
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 value="08">08-August</option>\'
+ \'<option value="09">09-September</option>\'
+ \'<option value="10">10-October</option>\'
+ \'<option value="11">11-November</option>\'
+ \'<option value="12">12-December</option>\'
+ \'</select>\'
+ \'<input type="text" autocomplete="off" name="jj" maxlength="2" size="2" value="d" placeholder="d">\'
+ \', <input type="text" autocomplete="off" name="aa" maxlength="4" size="4" value="Y" placeholder="Y">\'
+ \'@ <input type="text" autocomplete="off" name="hh" maxlength="2" size="2" value="H" placeholder="H">\'
+ \' : <input type="text" autocomplete="off" name="mn" maxlength="2" size="2" value="i" placeholder="i"></div></label>\'
);
});
将此添加到
functions.php 主题文件。
function my_enqueue() {
wp_enqueue_script(\'my_admin_script\', get_bloginfo(\'template_url\') . \'/js/admin-script.js\', array(\'jquery\'), false, true);
}
add_action(\'admin_init\', \'my_enqueue\');
function my_bulk_edit($action, $result){
if (\'bulk-posts\' == $action && $_GET[\'mm\']!=\'00\' && isset($_GET[\'jj\']) && isset($_GET[\'aa\']) && isset($_GET[\'hh\']) && isset($_GET[\'mn\']) ) {
$date = $_GET[\'aa\'].\'-\'.$_GET[\'mm\'].\'-\'.$_GET[\'jj\'].\' \'.$_GET[\'hh\'].\':\'.$_GET[\'mn\'].\':00\';
$post_date = date("Y-m-d H:i:s", strtotime($date));
$post_date_gmt = gmdate("Y-m-d H:i:s",strtotime($date));
$post_status = (strtotime($post_date) > strtotime(date("Y-m-d H:i:s")))? \'future\' : \'publish\';
$post_IDs = array_map(\'intval\', (array) $_GET[\'post\']);
foreach ($post_IDs as $post_ID) {
$post_data = array( \'ID\' => $post_ID, \'post_date\' => $post_date, \'post_date_gmt\' => $post_date_gmt, \'post_status\' => $post_status, \'edit_date\' => true );
//wp_insert_post( $post_data );
wp_update_post( $post_data );
}
}
}
add_action(\'check_admin_referer\', \'my_bulk_edit\', 10, 2);
这里是
screenshot