Support » Plugin: Kirki » Remove kirki customizer field from parent theme using child theme

  • Resolved WebHunt Infotech

    (@webhuntinfotech)


    Hi,

    I’m using a “kirki” customizer in kyma theme.

    Now i want to remove service 4 section from parent theme using “Child-Theme”.

    Here is a code snippet which i using in kyma parent theme.

    /* Service 4 */
    	Kirki::add_field('kyma_theme', array(
    		'settings'          => 'service_icon_4',
    		'label'             => __('Service Four Icon', 'kyma'),
    		'section'           => 'service_sec',
    		'type'              => 'text',
    		'priority'          => 10,
    		'transport'         => 'postMessage',
    		'default'           => $kyma_theme_options['service_icon_4'],
    		'sanitize_callback' => 'kyma_sanitize_text',
    	));
    	Kirki::add_field('kyma_theme', array(
    		'settings'          => 'service_title_4',
    		'label'             => __('Service Four Title', 'kyma'),
    		'section'           => 'service_sec',
    		'type'              => 'text',
    		'priority'          => 10,
    		'transport'         => 'postMessage',
    		'default'           => $kyma_theme_options['service_title_4'],
    		'sanitize_callback' => 'kyma_sanitize_text',
    	));
    	Kirki::add_field('kyma_theme', array(
    		'settings'          => 'service_text_4',
    		'label'             => __('Service Four Description', 'kyma'),
    		'section'           => 'service_sec',
    		'type'              => 'textarea',
    		'priority'          => 10,
    		'transport'         => 'postMessage',
    		'default'           => $kyma_theme_options['service_text_4'],
    		'sanitize_callback' => 'kyma_sanitize_textarea',
    	));
    	Kirki::add_field('kyma_theme', array(
    		'settings'          => 'service_link_4',
    		'label'             => __('Service Four URL', 'kyma'),
    		'section'           => 'service_sec',
    		'type'              => 'url',
    		'priority'          => 10,
    		'transport'         => 'postMessage',
    		'default'           => $kyma_theme_options['service_link_4'],
    		'sanitize_callback' => 'esc_url',
    	));

    Now i want to remove it using “Child-Theme”.

    Please provide a solution ASAP.

    Any help would be appreciated.

    Thank You

    https://wordpress.org/plugins/kirki/

Viewing 4 replies - 1 through 4 (of 4 total)
  • WebHunt Infotech

    (@webhuntinfotech)

    Hi,

    From last three days you did’t provide the solution

    So please provide the solution ASAP.

    Thank You

    dariodev

    (@dariodev)

    Try something like this:

    add_action( 'customize_register', 'childtheme_custom_remove', 100);
    function childtheme_custom_remove( $wp_customize ) {
        $wp_customize->remove_control( 'service_icon_4' );
        $wp_customize->remove_control( 'service_title_4' );
        $wp_customize->remove_control( 'service_text_4' );
        $wp_customize->remove_control( 'service_link_4' );
    }

    WebHunt Infotech

    (@webhuntinfotech)

    Hi,

    We have tried it but its not working.

    Have you any idea please.

    Thank You

    [ No bumping please. ]

    You can access the global Kirki fields and remove the field by doing something like this:

    add_action( 'after_setup_theme', function() {
        $fields = Kirki::$fields;
        unset( $fields['my_field'] );
        Kirki::$fields = $fields;
    });
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.