我如何在定制器woocommerce部分下添加选项?

时间:2019-01-20 23:18:26

标签: wordpress woocommerce wordpress-theming

https://prnt.sc/m9tiah

定制器部分的名称是什么?我想在定制程序woocommerce部分下添加一个字段选项。或者如何在woocommerce选项下添加字段?有人可以帮我吗?

$wp_customize->add_section( 'woocommerce_secction_name' , array(
        'title'    => __( 'My Section Name', 'starter' ),
        'priority' => 30
    ) );   

    $wp_customize->add_setting( 'starter_new_setting_name' , array(
        'default'   => '#000000',
        'transport' => 'refresh',
    ) );

    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
        'label'    => __( 'Header Color', 'starter' ),
        'section'  => 'woocommerce_secction_name',
        'settings' => 'starter_new_setting_name',
    ) ) );

1 个答案:

答案 0 :(得分:0)

// Add section to WooCommerce Panel
$wp_customize->add_section( 'SECTION_NAME',
  array(
    'title'      => __( 'SECTION TITLE'),
    'panel'      => 'woocommerce',
    'capability' => '',
    'priority'   => 500,
  )
);

重要的是面板名称,如您所见,选择woocommerce它将添加到woocomerce面板中