admin管理员组文章数量:1415460
I'm working on a custom meta box and i am trying to limit the Block format tag to just P, H3 and H4 tags, i did it this way and not sure why it doesn't display the block format dropdown;
wp_editor( $content, 'fm_display_callback', array (
'media_buttons' => false,
'textarea_rows' => 5,
'quicktags' => array(
'buttons' => 'strong,em,del,ul,ol,li,close'
),
'tinymce' => array(
'toolbar1' => 'bold,italic,underline,bullist,numlist,alignleft,forecolor,aligncenter,alignright,link,unlink,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
'block_formats' => "Paragraph=p; Heading 3=h3; Heading 4=h4",
),
) );
as listed on WordPress Codex, it doesnt work for some reason. I have as well tried making the block_formats
key into an array like this;
'block_formats' => array(
'Paragraph=p',
'Heading 3=h3',
'Heading 4=h4',
)
and like this;
'block_formats' => array(
'Paragraph' => 'p',
'Heading 3' => 'h3',
'Heading 4' => 'h4',
)
Not sure what i'm missing that is preventing the block format to display, as this is what i get visually (No dropdown)
I'm working on a custom meta box and i am trying to limit the Block format tag to just P, H3 and H4 tags, i did it this way and not sure why it doesn't display the block format dropdown;
wp_editor( $content, 'fm_display_callback', array (
'media_buttons' => false,
'textarea_rows' => 5,
'quicktags' => array(
'buttons' => 'strong,em,del,ul,ol,li,close'
),
'tinymce' => array(
'toolbar1' => 'bold,italic,underline,bullist,numlist,alignleft,forecolor,aligncenter,alignright,link,unlink,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
'block_formats' => "Paragraph=p; Heading 3=h3; Heading 4=h4",
),
) );
as listed on WordPress Codex, it doesnt work for some reason. I have as well tried making the block_formats
key into an array like this;
'block_formats' => array(
'Paragraph=p',
'Heading 3=h3',
'Heading 4=h4',
)
and like this;
'block_formats' => array(
'Paragraph' => 'p',
'Heading 3' => 'h3',
'Heading 4' => 'h4',
)
Not sure what i'm missing that is preventing the block format to display, as this is what i get visually (No dropdown)
Share Improve this question asked Sep 10, 2019 at 19:02 Kolawole Emmanuel IzzyKolawole Emmanuel Izzy 2031 silver badge8 bronze badges1 Answer
Reset to default 2You need to add formatselect
in one of the toolbars, and WordPress by default have it in toolbar1
:
wp_editor( $content, 'fm_display_callback', array(
...
'tinymce' => array(
'toolbar1' => 'formatselect,bold,italic,...',
...
),
) );
Check this and https://www.tiny.cloud/docs-4x/configure/content-formatting/#block_formats.
本文标签: tinymceLimit Block format tags in WordPress wpeditor
版权声明:本文标题:tinymce - Limit Block format tags in WordPress wp_editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745169172a2645866.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论