【问题标题】:How to return value from function in color?如何以颜色从函数返回值?
【发布时间】:2017-11-01 08:10:19
【问题描述】:

我有这个功能:

add_filter( 'woocommerce_variation_is_active', 
'grey_out_variations_when_is_backorder', 10, 2 );
function grey_out_variations_when_is_backorder( $grey_out, $variation ) {

if ( ! $variation->is_in_stock() && $variation->backorders_require_notification() )
    $grey_out = false;

return $grey_out; // Here want to return value in some color?


}

那么想知道如何以某种颜色返回值吗?功能是将 WooCommerce 商店中没有库存的产品变灰。目前仅以某些灰色为背景灰色选择。一些提示或建议如何恢复颜色价值?

当前状态:

我想这样显示:

【问题讨论】:

    标签: wordpress variables colors woocommerce variation


    【解决方案1】:

    如果前端禁用了灰显的选择>选项项(disabled="disabled"),那么您可以对这些项应用一些 CSS:

    select option:disabled {
        color: #F00;
    }
    

    【讨论】:

    • 这是用颜色控制该部分的 CSS:.variations .select-wrapper .sbOptions li span.sbDisabled, .variations .sbHolder .sbOptions li span.sbDisabled { CSS code.. }
    • 另外,如果我有更多不同的函数返回数据呢?如何处理该功能中的不同颜色?在这里查看我的问题:stackoverflow.com/questions/44168656/…
    猜你喜欢
    • 1970-01-01
    • 2015-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-17
    • 2020-03-09
    • 1970-01-01
    相关资源
    最近更新 更多