Skip to content

Instantly share code, notes, and snippets.

@yuliyang
Last active October 18, 2021 03:35
Show Gist options
  • Save yuliyang/1289b430ef9141d4d71ea86df0b06f04 to your computer and use it in GitHub Desktop.
Save yuliyang/1289b430ef9141d4d71ea86df0b06f04 to your computer and use it in GitHub Desktop.
[WooCommerce] Add/Rename Product Tabs
<?php
// Add product tabs
add_filter( 'woocommerce_product_tabs', 'ching_woo_new_tab' );
function ching_woo_new_tab( $tabs ) {
// rename description tab title
$tabs['description']['title'] = __( '商品特色' );
// add the new tab - specs
$tabs['specs'] = array(
'title' => __( '商品規格', 'woocommerce' ),
'priority' => 20,
'callback' => 'ching_woo_new_tab_content'
);
return $tabs;
}
// The new tab content
function ching_woo_new_tab_content() {
echo '<div class="content">';
echo 'Hi!';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment