wordpress - Setting the name of a WooCommerce Extra tab using php? -
Actually I have some settings at the top of a php file:
$ Wooc_product_faq_name = 'FAQ'; // Set the tab name for frequently asked questions I want to allow it to change the tab name of the following in my WooCommerce plugin:
add_filter ('woocommerce_product_tabs', 'wooc_product_faq'); Function wooc_product_faq ($ tabs) {// new tab $ tab ['FAQ'] = array ('title' = & gt; __ ($ wooc_product_faq_name, 'woocommerce'), 'priority' => 99, // adds priority Order's effect, 99 tab puts 'callback' => end of 'wooc_product_faq_content'); Return $ Tab; } However this will not let me do this. It does not just produce anything and if I
'title' => __ ($ wooc_product_fac_name, 'woocommerce'), to
'title' = & gt; __ ('$ wooc_product_fac_name', 'woocommerce'), then outputs it correctly but text $ wooc_product_ffa_name is not desired in the tab name FAQ . You can view the whole file here:
Have you tried this ??
// Configuration global $ wooc_product_faq_name; $ Wooc_product_faq_name = 'FAQ'; // Set the tab name for frequently asked questions // * Add often tab tab filter add_filter ('woocommerce_product_tabs', 'wooc_product_faq'); Function wooc_product_faq ($ tabs) {global $ wooc_product_faq_name; // New tab $ tab ['FAQ'] = Array ('title' => gt; __ ($ wooc_product_faq_name, 'woocommerce'), 'priority' => 99, adds priority effect, order 99, Tab 'callback' = & gt; at the end of 'wooc_product_faq_content'); Return $ Tab; } It may help you
Comments
Post a Comment