【问题标题】:Styling custom fields added in the backend in WooCommerce在 WooCommerce 的后端添加样式自定义字段
【发布时间】:2020-09-12 00:56:15
【问题描述】:

我添加了一个自定义字段,我希望标签文本从新行开始。目前它开始于价格字段之间。

我可以设计它吗?还是我不能更改优先级以将其移动到另一行?

我正在使用:WooCommerce: Get custom field from product variations and display it as a suffix to variation prices

【问题讨论】:

  • 显示您的代码。也许它只需要通过 CSS 设置样式。

标签: php wordpress woocommerce custom-fields


【解决方案1】:

你可以添加一个包装类'wrapper_class' => 'form-row-full',

对于wrapper_class,还有其他可能性:

  • form-row-first - 宽度的 50%,左侧
  • form-row-last - 宽度的 50%,右侧
  • form-row-full - 宽度的 100%,完全
 // 1. Add custom field input @ Product Data > Variations > Single Variation
add_action( 'woocommerce_variation_options_pricing', 'Add_bulk_price_to_variations', 10, 3 );
function Add_bulk_price_to_variations( $loop, $variation_data, $variation ) {  
    woocommerce_wp_text_input( array(
        'id' => 'bulk_price[' . $loop . ']',
        'desc_tip'    => 'true',
        'description' => __( 'Enter the Bulk price here.', 'woocommerce' ),
        'label' => __( 'Custom Field', 'woocommerce' ),
        'wrapper_class' => 'form-row-full',
        'value' => get_post_meta( $variation->ID, 'bulk_price', true ) 
    ));
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-29
    • 2015-05-03
    • 2019-07-29
    • 2022-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多