Created
May 8, 2017 22:07
-
-
Save juniorthiesen/17988a9b12f748554e19de1d90fa9cb4 to your computer and use it in GitHub Desktop.
Add custom column to shop_order post type
This file contains hidden or 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 | |
function add_custom_column_to_shop_order( $columns ) { | |
$new_columns = is_array( $columns ) ? $columns : array(); | |
$new_columns['software_key'] = __( 'WhatsApp' ); | |
return $new_columns; | |
} | |
add_filter( 'manage_edit-shop_order_columns', 'add_custom_column_to_shop_order' ); | |
function add_custom_column_value_to_shop_order( $column ) { | |
global $post; | |
if ( $column == 'software_key' ) { | |
echo $post->post_status; | |
} | |
} | |
add_action( 'manage_shop_order_posts_custom_column', 'add_custom_column_value_to_shop_order' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment