Skip to content

Instantly share code, notes, and snippets.

View skylarkcob's full-sized avatar

Cuong Dinh Lai skylarkcob

View GitHub Profile
@mjangda
mjangda / widget-post-save.js
Created September 9, 2010 20:21
Hook into the WordPress widget save javascript callback
jQuery(document).ajaxSuccess(function(e, xhr, settings) {
var widget_id_base = 'mywidget';
if(settings.data.search('action=save-widget') != -1 && settings.data.search('id_base=' + widget_id_base) != -1) {
alert('yay!');
// do other stuff
}
});
@danielck
danielck / customizer-preview.js
Last active March 16, 2021 11:19
Some basic Customizer examples
/*
Include this file in your theme and enqueue it like this in PHP:
function my_customize_preview_js() {
wp_enqueue_script( 'customizer-preview', get_template_directory_uri() . '/path/to/customizer.js', array( 'customize-preview' ), '20170422', true );
}
add_action( 'customize_preview_init', 'my_customize_preview_js' );
*/