Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Woocommerce:删除;补充资料“;标签_Php_Wordpress_Woocommerce_Hook Woocommerce - Fatal编程技术网

Php Woocommerce:删除;补充资料“;标签

Php Woocommerce:删除;补充资料“;标签,php,wordpress,woocommerce,hook-woocommerce,Php,Wordpress,Woocommerce,Hook Woocommerce,我试图在本网站的产品页面上做两件事: 1) 删除“附加信息”选项卡 2) 在产品描述上方添加属性“大小” 要删除“附加信息”选项卡,我一直在执行以下操作: 这就是我所做的: 1) 添加了自定义插件并将其激活- 2) 尝试通过编辑/wp content/plugins/woocommerce/templates/single product/tabs中的tabs.php来删除“其他信息” /** * Removes the "Additional Information" tab that di

我试图在本网站的产品页面上做两件事:

1) 删除“附加信息”选项卡 2) 在产品描述上方添加属性“大小”

要删除“附加信息”选项卡,我一直在执行以下操作:

这就是我所做的: 1) 添加了自定义插件并将其激活-

2) 尝试通过编辑/wp content/plugins/woocommerce/templates/single product/tabs中的tabs.php来删除“其他信息”

/**
 * Removes the "Additional Information" tab that displays the product attributes.
 * 
 * @param array $tabs WooCommerce tabs to display.
 * 
 * @return array WooCommerce tabs to display, minus "Additional Information".
 */
function tutsplus_remove_product_attributes_tab( $tabs ) {

    unset( $tabs['additional_information'] );

    return $tabs;

}

add_filter( 'woocommerce_product_tabs', 'tutsplus_remove_product_attributes_tab', 100 );
这就是我被困的地方。我甚至尝试一起删除additional-information.php文件(在同一个tabs文件夹中),但仍然会显示其他信息

我尝试将上述代码放在tabs.php文件的三个不同区域中,但对产品页面上的选项卡没有任何影响


还有其他建议吗?对于最新的woocommerce版本,可能有一种不同/更好的方法

也许您需要将优先级从100更改为98,如中所示,将代码放在functions.php文件中

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {

    unset( $tabs['additional_information'] );   // Remove the additional information tab

    return $tabs;

}

这对我删除选项卡起到了作用:

在functions.php中添加以下内容:

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {

    unset( $tabs['description'] );          // Remove the description tab
    unset( $tabs['reviews'] );          // Remove the reviews tab
    unset( $tabs['additional_information'] );   // Remove the additional information tab

    return $tabs;

}

要返回要在“说明”下显示的属性,我想不出来,所以我只是在“说明”中添加了大小

谢谢,我要试试这个!我把它放在函数php文件的什么地方重要吗?不重要,你可以把它放在文件的末尾。