Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Modify/Remove Tabs
- add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
- function woo_remove_product_tabs( $tabs ) {
- unset( $tabs['description'] );
- unset( $tabs['reviews'] );
- unset( $tabs['additional_information'] );
- return $tabs;
- }
- // Add new tabs
- add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
- function woo_new_product_tab( $tabs ) {
- // Adds the new tabs
- $tabs['desc'] = array(
- 'title' => __( 'Description', 'woocommerce' ),
- 'priority' => 50,
- 'callback' => 'woo_new_product_tab_description'
- );
- $tabs['ingredients'] = array(
- 'title' => __( 'Ingredients', 'woocommerce' ),
- 'priority' => 51,
- 'callback' => 'woo_new_product_tab_ingredients'
- );
- $tabs['tips'] = array(
- 'title' => __( 'Tips', 'woocommerce' ),
- 'priority' => 52,
- 'callback' => 'woo_new_product_tab_tips'
- );
- return $tabs;
- }
- function woo_new_product_tab_description( $tab_nicename, $tab_data ){
- global $product;
- // The new tab content
- echo '<div class="wc-tab--title"><div class="wc-section--title"><span>' . $tab_data['title'] . '</span></div></div>';
- echo '<div class="wc-section--content">' . wpautop($product->post->post_content) . '</div>';
- }
- function woo_new_product_tab_ingredients( $tab_nicename, $tab_data ){
- global $product;
- $tab_content = get_post_meta($product->post->ID, 'product_ingredients', true);
- // The new tab content
- echo '<div class="wc-tab--title"><div class="wc-section--title"><span>' . $tab_data['title'] . '</span></div></div>';
- echo '<div class="wc-section--content">' . wpautop($tab_content) . '</div>';
- }
- function woo_new_product_tab_tips( $tab_nicename, $tab_data ){
- global $product;
- $tab_content = get_post_meta($product->post->ID, 'product_tips', true);
- // The new tab content
- echo '<div class="wc-tab--title"><div class="wc-section--title"><span>' . $tab_data['title'] . '</span></div></div>';
- echo '<div class="wc-section--content">' . wpautop($tab_content) . '</div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement