Created
July 2, 2020 17:50
-
-
Save kontikidigital/48142a266da5b4e7b80b126510b92419 to your computer and use it in GitHub Desktop.
WooCommerce Custom Tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Custom Tabs in WooCommerce */ | |
add_filter( 'woocommerce_product_tabs', 'mt_custom_product_tabs' ); | |
function mt_custom_product_tabs( $tabs ) { | |
unset( $tabs['description'] ); // Remove the description tab | |
unset( $tabs['reviews'] ); // Remove the reviews tab | |
unset( $tabs['additional_information'] ); // Remove the additional information tab | |
$tabs['custom_tab_1'] = array( | |
'title' => __( 'Custom Tab 1', 'mt-starter' ), | |
'callback' => 'mt_custom_tab1_content', //Callback function | |
'priority' => 50, | |
); | |
$tabs['custom_tab_2'] = array( | |
'title' => __( 'Custom Tab 2', 'mt-starter' ), | |
'callback' => 'mt_custom_tab2_content', | |
'priority' => 60, | |
); | |
return $tabs; | |
} | |
function mt_custom_tab1_content( $slug, $tab ) { | |
// Your Code for Custom Tab 1 | |
} | |
function mt_custom_tab2_content( $slug, $tab ) { | |
// Your Code for Custom Tab 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment