Add custom media_buttons for shortcode selection

I was looking for a simple way to create a menu for my shortcode items and although you can create tinymce plugins I found it to be a pain. So I decided to create a simplified select menu that would require me to change a little HTML to add new items. Adding this wordpress snippet to the functions.php of your wordpress theme will add a new select menu beside the add media icon. Edit the value= to change the inserted text.

This snippet has been recently updated ( shortcode selection ).



function add_sc_select(){
echo '&nbsp;<select id="sc_select">
<option value="[html][/html]">[html]</option>
<option value="[css][/css]">[css]</option>
<option value="[javascript][/javascript]">[javascript]</option>
add_action('admin_head', 'button_js');
function button_js() {
echo '<script src="" type="text/javascript"></script>
<script type="text/javascript">
$("#sc_select").change(function() {$("#content").val($("#content").val()+$("#sc_select :selected").val());})

Leave a comment