Shortcodes issue
-
Hi,
This is a very nice plugin!!!
I have a small problem:
I have some custom shortcodes.
I have added a dropdown list to insert the shortcodes into the editor using the following code:function add_sc_select(){ global $shortcode_tags; /* ------------------------------------- */ /* enter names of shortcode to exclude bellow */ /* ------------------------------------- */ $exclude = array("caption", "gallery", "playlist", "embed", "wp_caption", "audio", "video", "acf"); echo '?<select id="sc_select"><option>Shortcodes</option>'; foreach ($shortcode_tags as $key => $val){ if(!in_array($key,$exclude)){ $shortcodes_list .= '<option value="['.$key.'][/'.$key.']">'.$key.'</option>'; } } echo $shortcodes_list; echo '</select>'; } add_action('media_buttons','add_sc_select',11); function button_js() { echo '<script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#sc_select").change(function() { send_to_editor(jQuery("#sc_select :selected").val()); jQuery("#sc_select").val("Shortcodes"); return false; }); }); </script>'; } add_action('admin_head', 'button_js');
The above code works fine with the wordpress editor when editing posts and pages but not with the widget editor.
The shortcode select list shows up but there’s something wrong with the jQuery and it doesn’t insert the selected shortcodes.Any suggertions?
https://www.ads-software.com/plugins/black-studio-tinymce-widget/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Shortcodes issue’ is closed to new replies.