-
-
Save alemarengo/a6109beeeee01421b1ca to your computer and use it in GitHub Desktop.
Woocommerce: trying to change priority, add a custom tab and hide description tab if void
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
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' ); | |
function woo_new_product_tab( $tabs ) { | |
global $post; | |
$tabs['description']['priority'] = 25; | |
$tabs['reviews']['priority'] = 55; | |
$tabs['test_tab'] = array( | |
'title' => __( 'test_tab', 'woocommerce' ), | |
'priority' => 50, | |
'callback' => 'woo_new_product_tab_content' | |
); | |
$exists = get_post_meta($post->ID, 'product_description', true); | |
if ($exists == "") { | |
unset($tabs['description']); | |
} | |
return $tabs; | |
} | |
function woo_new_product_tab_content() { | |
// The new tab content | |
echo '<h2>New Product Tab</h2>'; | |
echo '<p>Here\'s your new product tab.</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there someone that can help me in finding why I cannot get test_tab? All the rest works greatly.