I have added a meta box in the page edit section:
add_meta_box('custom_section_box', 'Sections', array($this, 'section_box'), 'page','normal','high');
Within the box, there is a wp_editor call:
$tinymce_options = array('plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify",'toolbar2'=>"blockquote,hr,table,bullist,numlist,undo,redo,link,unlink");
$editor_config= array('teeny'=>true, 'textarea_rows'=>10, 'editor_class'=>'csec_text', 'textarea_name'=>'csec_body', 'wpautop'=>false, 'tinymce'=>$tinymce_options);
wp_editor(html_entity_decode(stripslashes($vals['content'])), 'csec_body', $editor_config);
Everything is working fine, but when I add a gallery through the media button, it displays the gallery shortcode only (like [gallery link="file" ids="759,760,761"]). There is no usual display of the gallery as in the normal page editor with edit/delete buttons.
I had tried to add the do_shortcode to pass the value in wp_editor, but that displays the full html instead. Also other shortcodes are rendered as html.
Can you please help?
I have added a meta box in the page edit section:
add_meta_box('custom_section_box', 'Sections', array($this, 'section_box'), 'page','normal','high');
Within the box, there is a wp_editor call:
$tinymce_options = array('plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify",'toolbar2'=>"blockquote,hr,table,bullist,numlist,undo,redo,link,unlink");
$editor_config= array('teeny'=>true, 'textarea_rows'=>10, 'editor_class'=>'csec_text', 'textarea_name'=>'csec_body', 'wpautop'=>false, 'tinymce'=>$tinymce_options);
wp_editor(html_entity_decode(stripslashes($vals['content'])), 'csec_body', $editor_config);
Everything is working fine, but when I add a gallery through the media button, it displays the gallery shortcode only (like [gallery link="file" ids="759,760,761"]). There is no usual display of the gallery as in the normal page editor with edit/delete buttons.
I had tried to add the do_shortcode to pass the value in wp_editor, but that displays the full html instead. Also other shortcodes are rendered as html.
Can you please help?
Share Improve this question edited May 1, 2019 at 13:41 sariDon asked May 1, 2019 at 12:55 sariDonsariDon 2651 gold badge2 silver badges18 bronze badges 5 |2 Answers
Reset to default 1Make sure tinymce
option has a valid value.
Remove it or set it to true if you don't pass any parameters to tinymce
$editor_config = array(
'teeny'=>true,
'textarea_rows'=>10,
'editor_class'=>'csec_text',
'textarea_name'=>'csec_body',
'wpautop'=>false,
'tinymce'=>$tinymce_options //THIS OPTION SHOULD BE VALID
);
Edit:
Made a small research. Add wpview
in plugins argument of tinymce options.
$tinymce_options = array(
'plugins' => "wpview,lists,link,textcolor,hr",
//all other options
}
Also, there is no tinymce table
plugin.
List of available plugins:
'charmap',
'colorpicker',
'hr',
'lists',
'media',
'paste',
'tabfocus',
'textcolor',
'fullscreen',
'wordpress',
'wpautoresize',
'wpeditimage',
'wpemoji',
'wpgallery',
'wplink',
'wpdialogs',
'wptextpattern',
'wpview',
This piece works perfectly:
$tinymce_options = array(
'plugins' => "paste,lists,link,textcolor,hr,media,wordpress,wpeditimage,wpgallery,wpdialogs,wplink,wpview",
'wordpress_adv_hidden'=> false,
'toolbar1'=>"formatselect,fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify,wp_adv",
'toolbar2'=>"blockquote,hr,table,bullist,numlist,outdent,indent,undo,redo,link,unlink,wp_fullscreen,wp_help"
);
Note I have added few wordpress related plugins in the tinymce options.
$editor_config
too – anton Commented May 1, 2019 at 13:36