Skip to content

Instantly share code, notes, and snippets.

@robspangler
Last active August 29, 2015 13:57
Show Gist options
  • Save robspangler/9758112 to your computer and use it in GitHub Desktop.
Save robspangler/9758112 to your computer and use it in GitHub Desktop.
add_action('media_buttons','add_sc_select',11);
function add_sc_select(){
echo '&nbsp;<select id="sc_select">
<option>Shortcode</option>
<option value="[html][/html]">[html]</option>
<option value="[css][/css]">[css]</option>
<option value="[javascript][/javascript]">[javascript]</option>
</select>';
}
add_action('admin_head', 'button_js');
function button_js() {
echo '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
$("#sc_select").change(function() {$("#content").val($("#content").val()+$("#sc_select :selected").val());})
});
</script>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment