-
-
Save buley/74126456b327ed7cbcb7 to your computer and use it in GitHub Desktop.
Managing WooCommerce Product 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 | |
/** | |
* Standard Tab Code from woocommerce-hooks.php | |
*/ | |
/* Product page tabs */ | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 ); | |
/** | |
* Removing a tab | |
* Add the following to your theme functions file to remove the reviews tab | |
*/ | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 ); | |
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 ); | |
/** | |
* Reordering the tabs | |
* First they must be removed and then added again in the order you would like by changing the priority | |
* If you use the WooCommerce Custom Product Tabs Lite plugin that has a priority of 25 | |
* | |
* Add the following to you theme functions file | |
* This code will allow the Tab Manager tab to be first, then attributes, the description, then reviews | |
*/ | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 ); | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 ); | |
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 ); | |
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 ); | |
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 ); | |
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 ); | |
/* Product page tabs */ | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 40 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 30 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 50 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 40 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 30 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 50 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment