Last active
August 29, 2015 13:59
-
-
Save justinstern/10745848 to your computer and use it in GitHub Desktop.
Sample code to demonstrate the display of product-specific content for a global tab with the WooCommerce Tab Manager plugin http://www.woothemes.com/products/woocommerce-tab-manager/ The content is taken from a Custom Field named 'product_specifications_tab_content' added to the product. This assumes that the product is using the Global Tab Layo…
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 | |
// Add everything below to your current theme's functions.php file | |
add_filter( 'woocommerce_tab_manager_tab_panel_content', 'wc_tab_manager_global_tab_product_specific_content', 10, 3 ); | |
function wc_tab_manager_global_tab_product_specific_content( $content, $tab, $product ) { | |
// tab by title slug | |
if ( 'product-specifications' == $tab['name'] ) { | |
// check for tab content | |
if ( $product_content = get_post_meta( $product->id, 'product_specifications_tab_content', true ) ) { | |
return $product_content; | |
} | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment