kirki icon indicating copy to clipboard operation
kirki copied to clipboard

Required arguments not working until i hit save.

Open randomideas opened this issue 11 years ago • 4 comments

I am following the documentation and it seems i cant make it to work real time. The fields where i added the required arguments only show when i hit save or when the browser refreshed.

Below is the code i created.

$fields[] = array(
    'type'        => 'radio',
    'settings'    => 'htypes',
    'label'       => __( '', 'kirki' ),
    'description' => __( '', 'kirki' ),
    'section'     => 'header_types',
    'priority'    => 10,
    'choices'     => array(
        'widget' => __( 'Widgetized', 'kirki' ),
        'predef' => __( 'Predefined', 'kirki' ),
    ),
);

$fields[] = array(
    'type'        => 'radio-image',
    'settings'    => 'headtype',
    'label'       => __( '', 'kirki' ),
    'description' => __( '', 'kirki' ),
    'section'     => 'header_types',
    'priority'    => 20,
    'default'    => 'htypes1',
    'choices'     => array(
        'htypes1' => __( 'First Option', 'kirki' ),
        'htypes2' => __( 'Second Option', 'kirki' ),
    ),
    'required'  => array(
        array(
            'setting'  => 'htypes',
            'value'    => 'predef',
            'operator' => '==',
        ),
    )
);

Any help are highly appreciated.

Thanks

randomideas avatar Jun 11 '15 20:06 randomideas

Do you have your theme somewhere I can download and test this? I can't replicate the issue you're having so it may depend on the rest of your code.

aristath avatar Jun 13 '15 15:06 aristath

Hi aristath,

Already send the theme via email.

Thanks

randomideas avatar Jun 15 '15 12:06 randomideas

'active_callback' option #227 tried to follow the instruction here but still not working for me. That's why i opted out to reach you and open this ticket.

Thanks

randomideas avatar Jun 15 '15 12:06 randomideas

@randomideas I replied to you on email. This seems to work fine using your config on other themes so there must be something else wrong. I also sent you on email a sample theme where this works using your configuration & fields so I'm closing this one as it's not a Kirki bug.

aristath avatar Jun 15 '15 18:06 aristath