Skip to content

Instantly share code, notes, and snippets.

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 stephensabatini/020e6712bff906171dea4e705ac42022 to your computer and use it in GitHub Desktop.
Save stephensabatini/020e6712bff906171dea4e705ac42022 to your computer and use it in GitHub Desktop.
<?php
// Add more buttons to the html editor
function add_quicktags() {
if (wp_script_is('quicktags')) {
?>
<script type="text/javascript">
QTags.addButton(
'example_input',
'input',
prompt
);
function prompt() {
var value = prompt('Enter an input value:', '');
if (value) {
QTags.insertContent('<input type="text" value="' + value + '" />');
}
}
</script>
<?php
}
}
add_action('admin_print_footer_scripts', 'add_quicktags');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment