Quantcast
Viewing all articles
Browse latest Browse all 31591

culture-cross on "PHP Function how to duplicate functio without redeclare error"

Hello there!!

I am using a function to add tabs to a product page on my site, culture-cross.org

I added one tab using a function. I want to add two tabs. So When I add the function again to function.php to make the second tab, I get this error:
Fatal error: Cannot redeclare woo_new_product_tab() (previously declared in /hermes/bosoraweb183/b1660/ipg.culturecrossorg1/test/wp-content/themes/MayaShop_WordPress_Theme/maya/functions.php:46) in /hermes/bosoraweb183/b1660/ipg.culturecrossorg1/test/wp-content/themes/MayaShop_WordPress_Theme/maya/functions.php on line 78

How do I add the function twice, to use it again?

This is the function:

add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'Ask a question', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);

return $tabs;

}
function woo_new_product_tab_content() {

// The new tab content

echo '<h2>Have a question? Just ask!</h2>';
echo do_shortcode('[customcontact form=5]');

}

THANK YOU!!!


Viewing all articles
Browse latest Browse all 31591

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>