-
-
Save imath/d6ca3c135c5a768f2018 to your computer and use it in GitHub Desktop.
How to take benefit of #6647
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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