I'm trying to add a dropdown menu to the MCE editors via a plugin. Unfortunately, it is showing up with some strange placement/alignment:
http://i1270.photobucket.com/albums/jj612/hendridm/screenshot.png
This seems like it should be simple, but I've been racking my brains trying to figure it out.
I tried add_action('media_buttons' ...) and add_action('media_buttons_context' ...), but it always aligns strangely. I don't care where the button is, per se. I just want it visible on both the Visual and HTML editors.
What am I doing wrong? Incidently, if I uncomment the /img/ua2.png button, it displays fine with correct alignment. Is there a better way to do this?
add_action('media_buttons','upsell_add_sc_select', 11);
function upsell_add_sc_select(){
$include = array(1 => "Ad #1", 2 => "Ad #2"); //test array
echo '<select id="upsell_add_select"> <option>Upsell Ads</option>';
foreach ($include as $key => $val){
$upsell_ad_id = explode("#", $key);
echo '<option value="[upsellad id='.$key.']">'.$val.'</option>';
}
echo '</select>';
//echo '<a href="#"><img src="/img/ua2.png" /></a>';
}
add_action('admin_head', 'button_js');
function button_js() {
echo '<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#upsell_add_select").change(function() {
send_to_editor(jQuery("#upsell_add_select :selected").val());
return false;
});
});
</script>';
}