Kirki: Can't define code field priority

Created on 10 Nov 2017  路  3Comments  路  Source: kirki-framework/kirki

Issue description:

The code field does not obey the priority setting and shifts position randomly on reload.

screen-recording-2017-11-10-19-49-58

Inspecting the code, it's possible to see an unused second instance of the code field.

screen-recording-2017-11-10-20-41-40

Version used:

3.0.13

(Did you try using the develop branch from github? There's a chance your issue has already been adressed there)
Yes, I did.

Using theme_mods or options?

theme_mods

Code to reproduce the issue (config + field(s))

/**
 * Add the theme configuration
 */
_s_Kirki::add_config( '_s_theme', array(
    'option_type' => 'theme_mod',
    'capability'  => 'edit_theme_options',
) );

/**
 * Add the kirki section
 */
_s_Kirki::add_section( 'kirki', array(
    'title'      => esc_attr__( 'Kirki', '_s' ),
    'priority'   => 2,
    'capability' => 'edit_theme_options',
) );

Kirki::add_field( '_s_theme', array(
    'type'        => 'code',
    'settings'    => 'code_demo',
    'label'       => __( 'Code Control', '_s' ),
    'section'     => 'kirki',
    'default'     => 'body { background: #fff; }',
    'priority'    => 10,
    'choices'     => array(
        'language' => 'css',
        'theme'    => 'monokai',
        'height'   => 250,
    ),
) );

Kirki::add_field( '_s_theme', array(
    'type'        => 'color',
    'settings'    => 'my_setting_b',
    'label'       => __( 'This is the label', '_s' ),
    'section'     => 'kirki',
    'default'     => '#0088CC',
    'priority'    => 20,
    'choices'     => array(
        'alpha' => true,
    ),
) );

Kirki::add_field( '_s_theme', array(
    'type'        => 'checkbox',
    'settings'    => 'my_setting_a',
    'label'       => __( 'This is the label', '_s' ),
    'section'     => 'kirki',
    'default'     => '1',
    'priority'    => 30,
) );

Most helpful comment

Thanks for fixing this, @aristath 馃憤

All 3 comments

FYI the reason I'm not responding to this one is not because I'm ignoring it, just trying to figure things out. 馃槃

Having the same issue. Also is it possible to change the height of the code control?

Thanks for fixing this, @aristath 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ravishakya picture ravishakya  路  7Comments

daviedR picture daviedR  路  6Comments

allysonsouza picture allysonsouza  路  3Comments

manuelmoreale picture manuelmoreale  路  3Comments

hussainnayani picture hussainnayani  路  4Comments