I’ve realised my previous statement was actually wrong, wordpress.com uses the polldaddy plugin, not wp-polls, and i’ve come up with something for you…(read on).
What about a jQuery solution that does the same thing as the post editor poll button?
One small downside, it always places the poll shortcode at the end of the content, keeps the script light, and saves me hours of time figuring out how to track the position in the content. If you can live with that, try out the code below (assuming you still have wp-polls activated), most of the code below is borrowed from that plugin..
if( is_admin() ) {
function add_poll_button_qp() {
?>
<script type="text/javascript">
/* <![CDATA[ */
var poll_messages = {
enter_poll_id: "Enter Poll ID",
enter_poll_id_again: "Error: Poll ID must be numeric\n\nPlease enter Poll ID again",
};
jQuery(document).ready( function($) {
$('#media-buttons').append('<a id="poll" href="#" title="Insert Poll Shortcode"><img src="<?php echo plugins_url('wp-polls/images/poll.png'); ?>" height="12" width="12" border="0" /></a>');
$('#poll').click( function() {
var poll_id = jQuery.trim( prompt( poll_messages.enter_poll_id ) );
while( isNaN( poll_id ) ) {
poll_id = jQuery.trim( prompt( poll_messages.enter_poll_id_again ) );
}
if( poll_id >= 1 && poll_id != null && poll_id != "") {
$( edCanvas ).val($( edCanvas ).val()+'[poll id="' + poll_id + '"]');
}
return false;
});
});
/* ]]> */
</script>
<?php
}
add_action( 'admin_head-index.php' , 'add_poll_button_qp' );
}
Can be placed in your theme’s functions.php to make it easy.. (can convert into plugin if you have a problem copying the above into your functions file).
You’ll see the poll image next to the other media buttons in the QuickPress widget, it will work exactly the same as the button you have in the main post editor, with exception to tracking where your cursor currently is in the content.