Title: SettingAPI
Last modified: April 1, 2017

---

# SettingAPI

 *  [miturn](https://wordpress.org/support/users/miturn/)
 * (@miturn)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/)
 * Hi,
 * I have a few quick questions.
 * 1 – I have an image panel setting. The setting api returns the image id. How 
   do I get the full size image url?
 * SettingAPI.onChange( ‘sidebar:theme_header_image’, function( to, from ) {
    $(‘.
   header-banner’).css({‘background-image’ : ‘url(‘+ to +’)’}); } );
 * 2 – I have a color custom setting in the sidebar and when the color is changed
   it doesn’t trigger onChange function.
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Andrew Worsfold](https://wordpress.org/support/users/andrewworsfold/)
 * (@andrewworsfold)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/#post-9011091)
 * Hi [@miturn](https://wordpress.org/support/users/miturn/) –
 * The easiest approach would be to re-render the element instead of relying on 
   a live JavaScript update. Changes to HTML markup, fetching of images etc. are
   best handled in this way.
 * Regarding your custom control: could you provide a sample of the code that you’ve
   written or given some idea of how you’ve added it?
 * Cheers,
    Andrew.
 *  Thread Starter [miturn](https://wordpress.org/support/users/miturn/)
 * (@miturn)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/#post-9011121)
 * Thanks Andrew.
 * For the custom control, I registered a setting:
 *     ```
       $panel_manager->add_setting( 'theme_menu_color', array(
       		        'default'               =>  "#000000",
       		        'sanitize_callback'     =>  'tailor_sanitize_color',
       			'refresh' => array( 'theme' => 'js', ),
       		    ) );
       ```
   
 * And then in canvas.js:
 *     ```
       SettingAPI.onChange( 'sidebar:theme_menu_color', function( to, from ) {
       		$('.theme-label').css({'color' : to });
           } );
       ```
   
 * It works once the page is refreshed. Just not the live js update.
 *  Plugin Author [Andrew Worsfold](https://wordpress.org/support/users/andrewworsfold/)
 * (@andrewworsfold)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/#post-9011139)
 * Sidebar settings don’t require that you specify a “refresh” method, however that
   shouldn’t matter. How have you registered the associated control? Is it a custom
   section as well?
 * What else are you doing in canvas.js? Are you sure that file has been enqueued
   properly?
 *  Thread Starter [miturn](https://wordpress.org/support/users/miturn/)
 * (@miturn)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/#post-9011144)
 * I tried the refresh after I couldn’t get it to work.
 *     ```
       $panel_manager->add_control( 'theme_menu_text_color', array(
       		        'label'                 =>  __( 'Navigation Font Color', 'theme' ),
       		        'description'           =>  __( '', 'theme' ),
       		        'type'                  =>  'color',
       		        'priority'              =>  15,
       		        'section'               =>  'general',
       		        'setting'               =>  'theme_menu_color',
       		    ) );
       ```
   
 * It seems that the wordpress color picker isn’t triggering a change.
 * I have quite a bit of other code in canvas.js that is working.
 *  Thread Starter [miturn](https://wordpress.org/support/users/miturn/)
 * (@miturn)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/#post-9024762)
 * Andrew appreciate the help. If I’m customizing something on the page that is 
   not a tailor element – like nav or header can I refresh the preview frame. Like
   in the wordpress customizer.
 * wp.customize.previewer.refresh(); or a selective refresh?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘SettingAPI’ is closed to new replies.

 * ![](https://ps.w.org/tailor/assets/icon.svg?rev=1417317)
 * [Tailor Page Builder](https://wordpress.org/plugins/tailor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tailor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tailor/)
 * [Active Topics](https://wordpress.org/support/plugin/tailor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tailor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tailor/reviews/)

## Tags

 * [onchange](https://wordpress.org/support/topic-tag/onchange/)

 * 5 replies
 * 2 participants
 * Last reply from: [miturn](https://wordpress.org/support/users/miturn/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/settingapi/#post-9024762)
 * Status: not resolved