Skip to content

Instantly share code, notes, and snippets.

@fbentele
Last active October 6, 2016 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbentele/7b4f383a7cda7530070b84ba67da29be to your computer and use it in GitHub Desktop.
Save fbentele/7b4f383a7cda7530070b84ba67da29be to your computer and use it in GitHub Desktop.
<?php
add_action('media_buttons', 'my_super_function');
function my_super_function(){
?>
<a href="#" id="aid-nf-insert-submission" class="button"><span class="nf-insert-form dashicons dashicons-feedback"></span> Shortcode einfügen</a>
<script>
jQuery(function($) {
$(document).ready(function(){
$("#aid-nf-insert-submission").click(function(){
// my code
});
$(document).on('click', '#aid-nf-insert-form', function(){
// my code
wp.media.editor.insert('my text');
});
});
});
</script>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment