Skip to content

Instantly share code, notes, and snippets.

@imath
Created October 6, 2015 20:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/d6ca3c135c5a768f2018 to your computer and use it in GitHub Desktop.
Save imath/d6ca3c135c5a768f2018 to your computer and use it in GitHub Desktop.
How to take benefit of #6647
<?php
/**
* Just a quick and dirty example!
*/
function test_attachment_js_actions() {
?>
<script type="text/javascript">
if ( 'undefined' !== typeof window.bp ) {
if ( window.bp.Avatar ) {
bp.Avatar.Attachment.on( 'change:url', function( data ) {
console.log( data.attributes );
} );
}
if ( window.bp.CoverImage ) {
bp.CoverImage.Attachment.on( 'change:url', function( data ) {
console.log( data.attributes );
} );
}
}
</script>
<?php
}
add_action( 'wp_footer', 'test_attachment_js_actions', 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment