任何人都可以使用if条件修改以下代码来执行以下操作:
如果名为“ uwa_auction_bids_history”的选项卡存在,则按原样对选项卡进行重新排序,但如果不存在,则仅对前两个选项卡进行重新排序(“ description&Additional_information”)。基本的if / else条件要添加到此代码段中,但我没有php知识,因此我需要好心人的帮助...
谢谢!
/**
* Reorder product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['description']['priority'] = 5; // Reviews first
$tabs['additional_information']['priority'] = 10; // Description second
$tabs['uwa_auction_bids_history']['priority'] = 15; // Additional information third
return $tabs;
}
答案 0 :(得分:0)
/**
* Reorder product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['description']['priority'] = 5; // Reviews first
$tabs['additional_information']['priority'] = 10; // Description second
if ($tabs[''] !== undefined)
{
$tabs['uwa_auction_bids_history']['priority'] = 15; // Additional information third
}
return $tabs;
}
答案 1 :(得分:0)
基于Slobodan的友好帮助,我已经调整了代码以完全满足我的需求。 感谢Slobodan的帮助!问题解决了!
1.add(1, Number) //=> 2
1.add('1', Number) //=> 2
1.add(1, String) //=> '11'