Support » Plugin: Kirki » Image partial_refresh

  • Resolved babula

    (@babula)


    How do i incorporate partial refresh with img tag. I don’t see any documentation on img tag specific partial refresh.

    I’m trying to do something like as below :

    Kirki::add_field( 'airspace_kirki_config_id', array(
    	'type'        => 'image',
    	'settings'    => 'about_image',
    	'label'       => esc_attr__( 'Image' , 'airspace'),
    	'description' => esc_attr__( 'Upload your preferred image', 'airspace' ),
    	'section'     => 'frontpage_section1',
    	'default'     => get_template_directory_uri().'/images/wrapper-img.png',
    	 'partial_refresh' => array(
    
            'about_image' => array(
               'selector' => 'img#about_image',
               'attr'     => 'src', //something like that
    
               'render_callback' => function(){
    
               	  return get_theme_mod('about_image');
               }
    
            )
    	 )
    ) );

    And front end is
    <img id="about_image" src="<?php echo esc_url( get_theme_mod('about_image') ); ?>" alt="Img">

    Also partial refresh blue pencil icon is not showing for img tag.

Viewing 1 replies (of 1 total)
  • babula

    (@babula)

    nvm, i’m a fool, all i had to do is wrap the img tag with a div or something and then use that div as selector and just output the img tag as it appears in front end

Viewing 1 replies (of 1 total)
  • The topic ‘Image partial_refresh’ is closed to new replies.