Support » Plugin: Kirki Customizer Framework » Different Inline

  • Resolved ThemeAWESOME

    (@tsquez)


    I have started to add Kirki to my theme and I noticed something in the header that has me concerned. I noticed that there is an inline style generated for each one of the elements I have added the output to:

    <style id='kirki-styles-theme_typography-inline-css' type='text/css'>
    body,h1,h2,h2,h4,h5,h6{font-family:"Source Sans Pro", Helvetica, Arial, sans-serif;font-weight:400;font-style:normal;text-transform:none;color:#3f3f3f;}
    </style>
    <link rel='stylesheet' id='kirki-styles-top_sidebar_width-css'  href='http://localhost/forge/wp-content/plugins/kirki/assets/css/kirki-styles.css' type='text/css' media='all' />
    <style id='kirki-styles-top_sidebar_width-inline-css' type='text/css'>
    .top-sidebar.grid-container{max-width:900px;}
    </style>
    <link rel='stylesheet' id='kirki-styles-inside_top_sidebar_width-css'  href='http://localhost/forge/wp-content/plugins/kirki/assets/css/kirki-styles.css' type='text/css' media='all' />
    <style id='kirki-styles-inside_top_sidebar_width-inline-css' type='text/css'>
    .inside-top-sidebar{max-width:800px;}
    </style>

    Is this supposed to happen? Is inline css generated for each one? Why are they not grouped together under one kirki-styles sheet?…just curious.

    Lovin’ the plugin by the way 😉

Viewing 5 replies - 1 through 5 (of 5 total)
  • Sorry the title got cut off. It was supposed to say Different Inline Styles Being Generated for each Element?

    I can only think o 1 thing that would cause this, and that’s using a different config-ID for every control you create.

    When you create a field in Kirki, the syntax looks something like this:
    Kirki::add_field( $config_id, $args );
    The $config_id argument is the same for ALL your fields, not different for each field.
    It is not the field-id, it is an id that helps Kirki understand what kind of options your fields will use as well as the capabilities required to edit those fields (for example theme_mod or option for option-type and edit_theme_options for capability).

    So this is what your code should look like:

    Kirki::add_config( 'my_theme', array(
    	'capability'    => 'edit_theme_options',
    	'option_type'   => 'theme_mod',
    ) );
    
    Kirki::add_field( 'my_theme', $field_1_args );
    Kirki::add_field( 'my_theme', $field_2_args );
    Kirki::add_field( 'my_theme', $field_3_args );

    Of course each field has its own args defined as an array, and the actual field-id is defined as the settings argument in there, but the important thing to notice above is that all fields in the above example use my_theme as the config-id, and that configuration is defined using Kirki::add_config.

    You can read more about adding configurations on https://aristath.github.io/kirki/docs/getting-started/config.html and adding fields on https://aristath.github.io/kirki/docs/getting-started/fields.html

    AH HA! Got yah sir, yes that makes sense. made the change, now everything is showing under one inline style declaration.

    AWESOME!!! Thanks for the help and the awesome plugin. Keep up the good work.

    Also I cannot say this enough “THIS IS ONE BADASS PLUGIN”… sorry I already gave you a review, so I thought I would just throw this in here.

    SIMPLY BADASS!!!! 🙂

    I’m glad I could help! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different Inline’ is closed to new replies.