Created
December 13, 2016 04:12
-
-
Save joshuadavidnelson/4827eed53b25362953fae9e7e95c3899 to your computer and use it in GitHub Desktop.
Alter the output of a specific WooCommerce My Account column, in this case replacing the date format used for displaying the order date.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Alter the date order output (in this case, the format of the displayed date). | |
* | |
* @param object $order | |
*/ | |
add_action( 'woocommerce_my_account_my_orders_column_order-date', 'alter_order_date_format', 10, 1 ); | |
function alter_order_date_format( $order ) { | |
echo '<time datetime="' . date( 'Y-m-d', strtotime( $order->order_date ) ) . '" title="' . esc_attr( strtotime( $order->order_date ) ) . '">' . date_i18n( 'm/d/Y', strtotime( $order->order_date ) ) . '</time>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment