Created
February 19, 2016 07:59
-
-
Save gizalink/ae5f69d25a77a659210f to your computer and use it in GitHub Desktop.
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 | |
//Ham kiem tra, neu san pham khong co mieu ta se thay the bang tab mieu ta custom | |
add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 ); | |
function woo_custom_description_tab( $tabs ) { | |
$id_product = get_the_id(); //get id product | |
$temp = get_post($id_product)->post_content; //get content | |
if($temp){ //kiem tra | |
return $tabs; | |
}else{ | |
$tabs['description'] = array( | |
'title' => __( 'New Product Tab', 'woocommerce' ), | |
'priority' => 5, | |
'callback' => 'woo_custom_description_tab_content' | |
); | |
return $tabs; | |
} | |
} | |
//Ham noi dung tab | |
function woo_custom_description_tab_content() { | |
echo '<h2>Custom Description</h2>'; | |
echo '<p>Here\'s a custom description</p>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment