【发布时间】:2014-04-24 09:14:42
【问题描述】:
基本上我在 php 文件的顶部有几个设置:
$wooc_product_faq_name = 'FAQ'; // Set the tab name for the FAQs
我想让它在我的 WooCommerce 插件中更改以下选项卡名称:
add_filter( 'woocommerce_product_tabs', 'wooc_product_faq' );
function wooc_product_faq( $tabs ) {
// Adds the new tab
$tabs['FAQ'] = array(
'title' => __( $wooc_product_faq_name , 'woocommerce' ),
'priority' => 99, // Priority effects the order, 99 puts it at the end of the tabs
'callback' => 'wooc_product_faq_content'
);
return $tabs;
}
但是它不会让我这样做。它只是不输出任何东西。如果我改变了
'title' => __( $wooc_product_faq_name , 'woocommerce' ),
到
'title' => __( '$wooc_product_faq_name' , 'woocommerce' ),
然后它输出正确,但选项卡名称中的文本是 $wooc_product_faq_name 不是所需的 FAQ。
您可以在此处查看完整文件:https://github.com/VagishVela/woocommerce-product-faq-tab/blob/dev/woocommerce-product-faq-tab.php
【问题讨论】:
标签: php wordpress woocommerce