Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinstern/10745848 to your computer and use it in GitHub Desktop.
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…
<?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