GithubHelp home page GithubHelp logo

themeum / kirki Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 329.0 34.73 MB

Extending the customizer

Home Page: https://kirki.org

License: MIT License

JavaScript 8.17% PHP 90.63% Shell 0.03% CSS 0.28% SCSS 0.70% Batchfile 0.01% TypeScript 0.17% HTML 0.01%
customizer kirki plugin theme-development toolkit wordpress wordpress-customizer wordpress-plugin wordpress-theme-development

kirki's People

Contributors

alxmedia avatar andrezrv avatar aristath avatar briancwelch avatar ciaranwhelan avatar contactjavas avatar danielortiz avatar dannycooper avatar dedalx avatar dennisnissle avatar digisavvymachine avatar fovoc avatar guillaumemolter avatar ibrahim-kardi avatar igmoweb avatar iliman avatar jrfnl avatar kawshar avatar manuelmoreale avatar mapsteps avatar mintbird avatar mohdsayed avatar naxvog avatar plazorax avatar ragzor avatar rinkuyadav999 avatar scrutinizer-auto-fixer avatar timelsass avatar vpratfr avatar wprashed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kirki's Issues

Remove styling

Hi Aristeides,

First of all, thank you very very much for this, I really enjoy it!

I have a question about the custom styling. Somehow, I can't seem to be able to remove this action to I can keep the default WordPress styling.

add_action( 'customize_controls_print_styles', array( $this, 'custom_css' ), 999 );

I have tried a bunch, like a lot, of combinations starting from this:
remove_action( 'customize_controls_print_styles', array('Kirki', 'custom_css'), 1000 );

I even editied the plugin creating the Kriki on wp_admin and stuff like that. Maybe it's because it's Fridayafternoon and it's beer o'clock. But I can't get it to work.

Hope you can help me with this little issue.

Ciao!

Output doesn't seem to inline any css

I tried to use the output method but it seems there is no result. I added this line of code in the config.php file that i use to configure kirki:

wp_enqueue_style( 'style_name', get_template_directory_uri().'/css/style_name.css' );

I have the above css file in css/style_name.css.
After this i set the stylesheet_id => 'style_name' and set the output of a select element like so:

...
'output' => array(
   'element' => '#page',
   'property' => 'max-width',
   'units' => 'px'
)

Nothing happens the iframe refreshes but there is nothing happening. Also even if i save nothing happen.

Should i expect something?

_s theme's Site Title & Tagline not live update.

When I use it with _s theme's Site Title & Tagline, such as this code in /inc/customizer.php ,

$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';

I think it conflicts with Kirki. It's not live update as other inputs.

Is this a bug, or do you recommend me to NOT using _s's customizer code and use just Kirki instead?

PS. I put it to my GPL theme - Blogberry.

Thank you so much

kirki-2

postMessage for reloading changes asynchronously

I read in the Customizer API that in order for the JS Handler script for asynchronously reloading to work, the argument:

     'transport' => 'postMessage'

needs to be passed when registering a setting. However, since kirki plugin got rid of the need to register settings, how can I add postMessage reloading so I can get realtime editing to work. Than you

How about Panels?

Kirki looks really easy to use. However, does it supports creation of "Panels"?

Multiple property outputs

Sometimes it's required for one control (i.e. color) to produce output for many properties (i.e. color and border-color).

To not break the existing API my proposition is to declare this as following:

$controls[] = array(
    'type'     => 'color',
    'setting'  => 'color_accents',
    'label'    => __( 'Accents Color', 'goodyear' ),
    'section'  => 'colors',
    'default'  => '#3498db',
    'priority' => 2,
    'output' => array(
        array(
            'element'  => '.btn',
            'property' => 'color'
        ),
        array(
            'element'  => '.btn-primary',
            'property' => 'border-color'
        )
    )
);

What do you think?

jQuery UI elements not rendering because of ID selector

You should consider to use jQuery Attribute Equals Selector for your ID selectors in the custom controls jQuery calls for UI elements (slider, image radios etc). A problem occurs when using ID's like my_options[my_setting] for a setting to save the theme_mod options in just one database entry as a serialized array.

http://api.jquery.com/attribute-equals-selector/

With the current selector syntax, the jQuery UI elements are not rendered because the brackets in the ID selector are not escaped. You could escape those brackets in the with double backslashes or simple use the Attribute Equals Selector for the ID.

Instead of:

$( '#input_id; ?>' ).buttonset();

you should consider to change it to:

$( '[id="input_id; ?>"]' ).buttonset(); for example.

doitmax

Add new control

Hi,
how can I add a new control? I need a H2 tag with label between tags.
Regards

Issues with the slider control in latest version

I've just updated to the latest version of the plugin and I've noticed that there's an issue with the slider control.

I have a slider control to control the alpha channel of a RGBa value. See below.
In the latest version the slider now only goes up to 0.9 instead of 1 and the value is always saved as 0.

If I change the max setting to a value above 1.0 then when the slider is on anything 1 and above it saves as that value but anything below 1 is treated as 0.

$controls[] = array(
            'type'     => 'slider',
            'setting'  => 'banner_main_heading_alpha',
            'label'    => __( 'Main heading background opacity.', 'HN' ),
            'section'  => 'banner_homepage_section',
            'default'  => 0.5,
            'priority' => 4,
            'choices'  => array(
                'min'  => 0,
                'max'  => 1,
                'step' => 0.1,
            ),
            'subtitle' => __( 'Set the opacity of the main heading background colour.', 'HN' ),
        );

kirik and less

Hi,
great framework!! I thinking about to integrate "kirik" with wp-less plugin. So I need to remove "inline style" after "save" and add configuration for wp-less plugin but I don't know which method should I change? Can you help me?

Regards

Theme Customizer Sanitization

There is a problem with a required setting with the WordPress theme check plugin, this is the error that i get:

REQUIRED: Found a Customizer setting that did not have a sanitization callback function. Every call to the add_setting() method needs to have a sanitization callback function passed.

Switch control doesn't work with required setting

Hi,
I try to create dependency field so I try to use required setting for field but fields doesn't show when switch is turn on. This is my controls array:

[20] => Array
        (
            [type] => checkbox
            [setting] => topbar_visible
            [mode] => switch
            [label] => Turn on top bar
            [default] => on
            [section] => topbar
        )

    [21] => Array
        (
            [type] => text
            [setting] => topbar_welcome_text
            [label] => Welcome text
            [default] => 
            [required] => Array
                (
                    [topbar_visible] => on
                )

            [section] => topbar
        )

    [22] => Array
        (
            [type] => checkbox
            [setting] => topbar_show_address
            [mode] => switch
            [label] => Show company address
            [default] => off
            [required] => Array
                (
                    [topbar_visible] => on
                )

            [section] => topbar
        )

Field "required" argument malfunction

I copy pasted the following code directly from kirki.org, and using Kirki as a plugin. Once the required control is visible, it will only close by clicking option 1. You can see in the attached image I have 2 selected. 3 is the required option.

  • Create the section
    */
    function my_custom_section( $wp_customize ) {

    // Create the "My Section" section
    $wp_customize->add_section( 'my_section', array(
    'title' => __( 'My Section', 'translation_domain' ),
    'priority' => 12
    ) );

}
add_action( 'customize_register', 'my_custom_section' );

/**

  • Create the setting
    */
    function my_custom_setting( $controls ) {

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'parent_setting',
'label' => __( 'My Setting', 'textdomain' ),
'section' => 'my_section',
'default' => 'option_1',
'priority' => 1,
'choices' => array(
'option_1' => __( 'Option 1', 'textdomain' ),
'option_2' => __( 'Option 2', 'textdomain' ),
'option_3' => __( 'Option 3', 'textdomain' ),
'option_4' => __( 'Option 4', 'textdomain' ),
),
);

$controls[] = array(
'type' => 'textarea',
'setting' => 'child_setting',
'label' => __( 'My Setting', 'textdomain' ),
'section' => 'my_section',
'default' => __( 'Default text', 'textdomain' ),
'priority' => 1,
'required' => array( 'parent_setting' => 'option_3' )
);
return $controls;
}
add_filter( 'kirki/controls', 'my_custom_setting' );

untitled-1

Google fonts?

Hi
i see there Class(class Kirki_Fonts) created for Google font but define any way how to use it.i am using this plguin in theme , if you provide any way or idea how to add Google fonts it would be grate .

Thanks

manual on how to use it

Hi,

I only coud find on how to make sections or controls,
but what about making the live_preview work or where to i assing controls on a element?

Import/Export?

Are there plans to add a feature for the import/export of Kirki theme customizer options?

Fatal error after update kirki framework

Hi,
today I upgrade kirki framework from github repository and after that I got fatal error below:
Fatal error: Class 'Kirki_Customize_Radio_Control' not found in ..\kirki\includes\class-kirki-controls.php on line 19

Fatal error with Kirki and Bootstrap shell.

Warning: Illegal string offset 'body' in E:\Web\wp-content\plugins\kirki\includes\class-kirki-style.php on line 140

Fatal error: Cannot use string offset as an array in E:\Web\wp-content\plugins\kirki\includes\class-kirki-style.php on line 140

Google fonts generate subset for selected fonts

Hi,
I found this solution for google fonts #32 but when I choise a font from drop-down list the subset parametr isn't genereted for select font (is always the same chackbox list). I think this should be added because different fonts have different subset and not all fonts have all charset encoding.

Regards
Michal

Adding Tooltips

So how does one go about creating tooltips or helper text for each option? Didn't see anything in the docs.

Thanks

Js vars doesn't change anything

@aristath i'm having the following control and i was wondering why the postMessage doesn't seem to do anything.

$controls[] = array(
           'type'     => 'color',
           'setting'  => 'header_background',
           'label'    => __( 'Header Background Color', 'bargain' ),
           'section'  => 'colors',
           'default'  => '#1abc9c',
           'priority' => 1,
           'transport'=> 'postMessage',
           'js_vars' => array(
                 'element'  => '#masthead',
                 'type'     => 'css',
                 'property' => 'backround-color'    
                 )     
         );

I tried to modify the code in class-kirki-scripts.php and i was able to see that the to parameter is valid so a color and if i stop the execution with debugger i'm able to set the color. I also tried to change the method for selecting to this:

$script .= '$("#customize-preview iframe").contents().find("' . $control['js_vars']['element'] . '").css("' . $control['js_vars']['property'] . '", to ? to : "" );';
$script .= '});';

I'm running wp 4.1.1 and using the already present $("'.$control['js_vars']['element'].'") does not seem to select it as it's in an iframe.

Is this something you guys are aware of?? If it is i might try to make a pull request if not maybe someone can guide me in the right direction.

Thanks for the awesome plugin!!

Using Background Control Options Manually

I'm wondering if there's a way to use use the background control options manually instead of having them automatically generated and output as an inline style? I'm already generating an inline style and would like to just combine everything in one so there aren't two separate inline styles in the head.

For example, using like this results in nothing -

$sfpbg = get_theme_mod( 'sfp_bg' );
$cssoutput = '';
if ( $sfpbg ) {
$cssoutput .=
".page-template-front-page-php .site-header { " . $sfpbg . " } \n";
}
if ( $cssoutput ) {
echo
"<style type="text/css">" . $cssoutput . "</style>";
}

However, I'm able to make other controls output properly with this method, just not the Background Control.

Not sure how to fix the appearance of the quot areas above, but those are style tags.

Color control doesn't clear

I just discovered that once a color is selected it does not clear or revert to the default color. When clicking the "Clear" button it does clear the color from the control, temporarily, but it does not clear the setting -- the theme still has the color applied and, when opening the customizer again, the color is still selected.

I tried with a set default and an empty default, the clear button just doesn't work. Sorry for not providing any technical details as I'm just the end user, not a coder. Let me know if you need a var_dump or debug info.

Default value doesn't auto selected in controls

When there is no value to controller it should select default value but it doesn't!

array(
'type' => 'select',
'setting' => 'font_to_lowercase',
'label' => __( 'Text Transform', 'font_to_lowercase' ),
'section' => 'typography',
'default' => 'upper_case',
'priority' => 2,
'choices' => array("upper_case"=>"Upper Case", "default_case"=>"Default Case"),
),

contrller

Syntax Error When Embedding

Hey there!
Great project! I'm looking to embed this into my theme and I'm getting this error:
Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ')' in /Users/Alex/Documents/Websites/somelikeitneat.dev/wp-content/themes/some-like-it-neat/library/inc/kirki/includes/functions/background-css.php on line 17

I was able to resolve this by using the code from the WP Repo plugin, the Github version is different/behind apparently.

Cheers!

Output Question

This looks awesome, thank you for sharing this hard work.

The output option requiring a stylesheet id, does this mean the CSS will be output to a file instead of inline in the head?

wp_enqueue_styles

You could just directly use wp_enqueue_style instead of using wp_register_style first.

wp_enqueue_style( 'kirki-customizer-css', $kirki_url . 'assets/css/customizer.css', NULL, NULL, 'all' );
wp_enqueue_style( 'kirki-customizer-ui',  $kirki_url . 'assets/css/jquery-ui-1.10.0.custom.css', NULL, NULL, 'all' );

https://github.com/aristath/kirki/blob/master/kirki.php#L61

Why are you not adding a version when enqueue it? I know by not changing the version when you update the css then depending on the hosting caching it will not update.

Fatal error after update kirki framework

I try to add group-title but after update I got error below:

Warning: include_once(../kirki/includes/controls/class-kirki-customize-group_title-control.php): failed to open stream: No such file or directory in ..\kirki\kirki.php on line 62

Please don't close tickets before I say "thanks" or mark the problem is resolved!

required arguments don't work anymore after update

Hi, I've upgraded to the new version and encountered an issue that required fields display all the time no matter what is selected in the parent setting. This worked beautifully in the old version. This is a sample code I use:

function swibu_layout_setting( $controls ) {
$controls[] = array(
'type' => 'radio',
'mode' => 'image',
'setting' => 'layout_option',
'label' => __( 'Layout', 'swibu' ),
'section' => 'layout',
'default' => 0,
'priority' => 3,
'choices' => array(
0 => get_template_directory_uri() . '/lib/plugins/kirki/assets/images/1c.png',
1 => get_template_directory_uri() . '/lib/plugins/kirki/assets/images/2cl.png',
2 => get_template_directory_uri() . '/lib/plugins/kirki/assets/images/2cr.png',
3 => get_template_directory_uri() . '/lib/plugins/kirki/assets/images/3cm.png',
),
);
return $controls;
}
add_filter( 'kirki/controls', 'swibu_layout_setting' );

function swibu_nav1_setting( $controls ) {
$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'navigation1',
'label' => __( 'Navigation', 'swibu' ),
'section' => 'layout',
'default' => 'option_1',
'priority' => 5,
'required' => array( 'layout_option' => 1 ),
'choices' => array(
'option_1' => __( 'Header', 'swibu' ),
'option_2' => __( 'Left Sidebar', 'swibu' ),
),
);
return $controls;
}
add_filter( 'kirki/controls', 'swibu_nav1_setting' );

Turn off the custom styles

Hi, I found this library is very interesting and awesome. Can't wait to try it on my upcoming theme. However, when I succeed to install it, I notice that you change the default WP customizer style with your own (dark colored). I prefer to use WP default style, can you show me how can I do it?

Thanks!

Multiple js errors in customizer page

Hi,
when I'm in customizer page in firebug console I see a lot of errors:

ReferenceError: jQuery is not defined
jQuery(document).ready(function($) {"use strict";  

When take a look on the source You will see that the kirki JS is before doctype.

Uncaught TypeError: Cannot read property 'frame_button' of undefined

Hello,

firstly thanks for your fantastic work, really enjoying the Kirki ;-)

I found an error with an "Upload Control" (type => 'upload'). I get this error message:

Uncaught TypeError: Cannot read property 'frame_button' of undefined

This happens on WordPress 4.1.

Please can you help me with that?

Thanks

Pavel

Combine generated CSS

We should parse all auto-generated CSS, combine all styles by property and then enqueue then in bulk instead of adding each one separately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.