Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial refresh for image field #991

Closed
Anydog opened this issue May 24, 2016 · 4 comments
Closed

Partial refresh for image field #991

Anydog opened this issue May 24, 2016 · 4 comments

Comments

@Anydog
Copy link

Anydog commented May 24, 2016

Issue description:

Can't make partial_refresh work, and cannot find the reason why.

Version used:

Version 2.3.2 plugin . Tried latest dev branch. - no change, issue remains

Using theme_mods or options?

using theme mods, but you can see that from code bellow.

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

Kirki::add_field( 'natura_micemade_customizer',array(
        'type'          => 'image',
        'settings'      => 'site_logo',
        'label'         => esc_html__( 'Site logo', 'natura' ),
        'description'   => esc_html__( 'Upload or choose from media library the logo for site.', 'natura' ),
        'help'          => esc_html__( 'if logo image is removed, site title text (in <h1> tag) will be displayed.', 'natura' ),
        'section'       => 'logo_section',
        'default'       => get_template_directory_uri() . '/images/logo.svg',
        'priority'      => 1,
        'output'      => array(
            array(
                'element'   => 'header.main-header #site-title span.logo, .sticker .logo-title-cloned',
                'property'  => 'background-image',
            ),
        ),

        'partial_refresh' => array(
            'site_logo' => array(
                'selector'        => 'header.main-header #site-title span.logo',
                'render_callback' => 'natura_micemade_partial_logo',
            ),
        ),
    )); 

the callback:

function natura_micemade_partial_logo() {

    $default_logo   = get_template_directory_uri() . '/images/logo.svg';
    $logo           = get_theme_mod( "site_logo", $default_logo );

    echo '<span class="logo-title'. ( $logo ? ' logo' : ' no-logo' ) .'" style="background-image:'. $logo .'">'. get_bloginfo( 'name' ).'</span>';
}
@ghost
Copy link

ghost commented May 24, 2016

I also have this problem, partial refresh not works in kirki

@aristath
Copy link
Contributor

fixed. Partial refreshes now work properly.

@ghost
Copy link

ghost commented May 25, 2016

Thank you so much, work like a charm. You save my life

@Anydog
Copy link
Author

Anydog commented May 25, 2016

Big thanks aristath :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants