Skip to content

Instantly share code, notes, and snippets.

@joeldbirch
Created April 24, 2013 06:26
Show Gist options
  • Save joeldbirch/5450036 to your computer and use it in GitHub Desktop.
Save joeldbirch/5450036 to your computer and use it in GitHub Desktop.
WordPress snippet to make FooBox's initialisation code appear last in the source order. Ensures FooBox assets are present prior to initialisation code running, preventing errors.
function fix_foobox_initialisation() {
remove_action('wp_print_footer_scripts', array($GLOBALS['foobox'], 'inline_dynamic_js') );
add_action('wp_footer', array($GLOBALS['foobox'], 'inline_dynamic_js'), 99999 );
}
add_action('wp', 'fix_foobox_initialisation');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment