Skip to content

Instantly share code, notes, and snippets.

@rwsite
Created June 5, 2018 13:06
Show Gist options
  • Save rwsite/097cab75f7a258d93b5bd08f7a77ac6f to your computer and use it in GitHub Desktop.
Save rwsite/097cab75f7a258d93b5bd08f7a77ac6f to your computer and use it in GitHub Desktop.
Показ ID катгорий товаров в WooCommerce
/**
* WooCommerce: Показ ID категорий
*/
// Добавляем столбец ID
function woo_cat_id_columns($columns){
$columns = array('tag_ID' => __('ID', 'rw-addon'))+ $columns;
return $columns;
}
add_filter("manage_edit-product_cat_columns", "woo_cat_id_columns");
// Отображаем столбец 'tag_ID'
function my_custom_taxonomy_columns_content( $content, $column_name, $term_id ){
if ( 'tag_ID' === $column_name ) {
$content = $term_id;
}
return $content;
}
add_filter( 'manage_product_cat_custom_column', 'my_custom_taxonomy_columns_content', 10, 3 );
//Добавим стили в админку
function cw_add_order_profit_column_style() {
$css = '.column-tag_ID { width: 40px; }';
wp_add_inline_style( 'woocommerce_admin_styles', $css );
}
add_action( 'admin_print_styles', 'cw_add_order_profit_column_style' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment