majeedraza

WooCommerce - Show the processing order count in the admin bar

Oct 25th, 2021 (edited)
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2. // WooCommerce - Show the processing order count in the admin bar
  3. add_action('admin_bar_menu', 'show_new_orders_in_admin_bar', 900 );
  4. function show_new_orders_in_admin_bar( $wp_admin_bar ) {
  5.   $order_count = wc_processing_order_count();
  6.   $args = array(
  7.       'id' => 'new_orders',
  8.       'title' => 'Orders'.' <span class="order_count">'.$order_count.'</span>',
  9.       'href' => 'https://topcode.co.uk/dev/wp-admin/edit.php?post_type=shop_order',
  10.       'meta' => array(
  11.           'class' => 'show_new_orders_in_admin_bar',
  12.           'title' => 'Show new orders'
  13.           )
  14.   );
  15.   $wp_admin_bar->add_node($args);
  16. }
  17. ?>
  18.  
  19. /* Then some custom css to make it show in red */
  20. #wpadminbar .order_count {
  21.   display: inline-block;
  22.   min-width: 13px;
  23.   height: 17px;
  24.   padding: 0 4px 4px;
  25.   text-align: center;
  26.   line-height: 1.6;
  27.   background-color: #d63638;
  28.   border-radius: 10px;
  29. }
  30. /* This will need an admin-side css plugin. */
Add Comment
Please, Sign In to add comment