I am trying to add a timestamp to the Date column of my WooCommerce Orders screen.
Anybody know how I can do this? I am using WordPress 4.4.5. and WooCommerce Stable tag: 2.6.4.
I am trying to add a timestamp to the Date column of my WooCommerce Orders screen.
Anybody know how I can do this? I am using WordPress 4.4.5. and WooCommerce Stable tag: 2.6.4.
Well,simply by using a filter and little function
Here is the code to paste in functions.php
in the theme folder to make this change:
add_filter( 'post_date_column_time' , 'woo_custom_post_date_column_time' );
function woo_custom_post_date_column_time( $post ) {
$h_time = get_post_time( __( 'd/m/Y', 'woocommerce' ), $post );
return $h_time;
}
If you would like to print a timestamp, you can use this small pirce of code in your theme functions.php
file or in your custom plugin:
add_action( 'manage_posts_custom_column', 'misha_date_clmn' );
function misha_date_clmn( $column_name ) {
global $post;
if( $column_name == 'order_date' ) {
echo strtotime( $post->post_date ) . '<br />';
}
}
This code adds a timestamp just before the original date printed by WooCommerce. If you want to print timestamp INSTEAD the date, it is better to