parent}&menu_order=ASC&hide_empty=0");
foreach ($siblings as $sibling) {
if( $sibling->term_id == $term_id ) continue;
$next_id = $sibling->term_id; // first sibling term of the hierarchy level
break;
}
// reorder
woocommerce_order_terms( $term, $next_id, $taxonomy );
}
/**
* Delete terms metas on deletion
*/
add_action("delete_product_term", 'woocommerce_delete_term', 5, 3);
function woocommerce_delete_term( $term_id, $tt_id, $taxonomy ) {
$term_id = (int) $term_id;
if(!$term_id) return;
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->woocommerce_termmeta} WHERE `woocommerce_term_id` = " . $term_id);
}
/**
* Description for product_cat page
*/
add_action('product_cat_pre_add_form', 'woocommerce_product_cat_description');
function woocommerce_product_cat_description() {
echo wpautop(__('Product categories for your store can be managed here. To change the order of categories on the front-end you can drag and drop to sort them. To see more categories listed click the "screen options" link at the top of the page.', 'woothemes'));
}
/**
* Description for shipping class page
*/
add_action('product_shipping_class_pre_add_form', 'woocommerce_shipping_class_description');
function woocommerce_shipping_class_description() {
echo wpautop(__('Shipping classes can be used to group products of similar type. These groups can then be used by certain shipping methods to provide different rates to different products.', 'woothemes'));
}
/**
* Fix for per_page option
* Trac: http://core.trac.wordpress.org/ticket/19465
*/
add_filter('edit_posts_per_page', 'woocommerce_fix_edit_posts_per_page', 1, 2);
function woocommerce_fix_edit_posts_per_page( $per_page, $post_type ) {
if ($post_type!=='product') return $per_page;
$screen = get_current_screen();
if (strstr($screen->id, '-')) {
$option = 'edit_' . str_replace('edit-', '', $screen->id) . '_per_page';
if (isset($_POST['wp_screen_options']['option']) && $_POST['wp_screen_options']['option'] == $option ) :
update_user_meta( get_current_user_id(), $option, $_POST['wp_screen_options']['value'] );
wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
exit;
endif;
$user_per_page = (int) get_user_meta( get_current_user_id(), $option, true );
if ($user_per_page) $per_page = $user_per_page;
}
return $per_page;
}