Custom product inquiry tab
authorLaury GvR <laury@gaslightmedia.com>
Tue, 12 Apr 2016 17:02:35 +0000 (13:02 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 12 Apr 2016 17:02:35 +0000 (13:02 -0400)
functions.php

index 3029213..24edf96 100644 (file)
@@ -75,21 +75,24 @@ function glm_site_scripts()
 
 }
 
-// This function is to always have the WooCommerce custom tab from the 
-// "Woocommerc Custom Product Tabs Lite" always display the product inquiry form
-function sv_change_custom_tab_content( $content ) {
-    $content = '[gravityform id="2" title="true" description="true"]';
-    return $content;
+// This function is to always have the WooCommerce product inquiry tab display
+add_filter( 'woocommerce_product_tabs', 'woo_product_inquiry_tab' );
+function woo_product_inquiry_tab( $tabs ) {
+       
+       // Adds the new tab
+       
+       $tabs['test_tab'] = array(
+               'title'         => __( 'Product Inquiry 2', 'woocommerce' ),
+               'priority'      => 50,
+               'callback'      => 'woo_product_inquiry_content'
+       );
+
+       return $tabs;
+
 }
-add_filter( 'woocommerce_custom_product_tabs_lite_content', 'sv_change_custom_tab_content' );
-// This function is to always have the WooCommerce custom tab from the 
-// "Woocommerc Custom Product Tabs Lite" always have the title "Product Inquiry"
-function sv_change_custom_tab_title( $title ) {
-    $title = 'Product Inquiry';
-    return $title;
+function woo_product_inquiry_content() {
+       echo do_shortcode('[gravityform id="2" title="true" description="true"]');
 }
-add_filter( 'woocommerce_custom_product_tabs_lite_title', 'sv_change_custom_tab_title' );
-// if needed, tab order may perhaps be changeable with $tabs['my-custom-product']['priority'] = 5; or something equivalent
 
 /* Header for posts*/
 function glm_get_header() {