Skip to content

Instantly share code, notes, and snippets.

@renanlara
Last active December 15, 2015 09:19
Show Gist options
  • Save renanlara/5237740 to your computer and use it in GitHub Desktop.
Save renanlara/5237740 to your computer and use it in GitHub Desktop.
WooCommerce - Add new tab in products.
<?php
// Benefícios
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['beneficios'] = array(
'title' => __( 'Benefícios', 'woocommerce' ),
'priority' => 25,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>Benefícios</h2>';
echo '<p>Em Construção! :P</p>';
}
// Tabela Nutricional
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_two' );
function woo_new_product_tab_two( $tabs ) {
// Adds the new tab
$tabs['tabela_nutricional'] = array(
'title' => __( 'Tabela Nutricional', 'woocommerce' ),
'priority' => 30,
'callback' => 'woo_new_product_tab_content_two'
);
return $tabs;
}
function woo_new_product_tab_content_two() {
// The new tab content
echo '<h2>Tabela Nutricional</h2>';
echo '<p>Em Construção! :P</p>';
}
// Composição
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_three' );
function woo_new_product_tab_three( $tabs ) {
// Adds the new tab
$tabs['composição'] = array(
'title' => __( 'Composição', 'woocommerce' ),
'priority' => 35,
'callback' => 'woo_new_product_tab_content_three'
);
return $tabs;
}
function woo_new_product_tab_content_three() {
// The new tab content
echo '<h2>Composição</h2>';
echo '<p>Em Construção! :P</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment