Wordpress 管理编辑器 [英] Wordpress Admin Editor

查看:39
本文介绍了Wordpress 管理编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在后台编辑器中启用多个 <br/> 标签,因为用户按下 [SHIFT + ENTER].就像 Gmail 编辑器一样.

I want to enable multiple <br /> tags in the back office editor as user press [SHIFT + ENTER]. Like Gmail Editor.

否则,我需要在 [SHIFT + ENTER] 上禁用换行符,它应该只添加 <p>像正常输入一样的标签,我知道 <br/> 然后无法添加.但这是针对中文网站的.所以他们不介意换行.

Otherwise, I need to disable line breaks on [SHIFT + ENTER] and it should just add <p> a tag like normal enter, I know <br /> could not be added then. But this is for Chinese website. So they do not mind line breaks.

我试过了

  1. 禁用 wpautop 插件 - 但现有文章正在影响

  1. Disable wpautop plugin - But existing articles are affecting

TinyMCE 高级 - 不符合上述要求

TinyMCE advanced - does not meet the above requirements

高级 TinyMCE 配置 - force_br_lines:true,force_p_lines:false

Advanced TinyMCE config - force_br_lines: true, force_p_lines : false

感谢任何帮助.

推荐答案

我终于找到了解决方案.希望对其他人有用.

Finally I get solution after hard time. Hope it will be useful for others.

请按照以下步骤操作.

  1. 安装高级 tinymce 配置插件 -高级 Tinymce 配置

编辑设置页面并添加以下自定义变量

Edit the settings page and add the below custom variables

wpautop false
force_br_newlines true
force_p_newlines false

  • 安装切换 wpautop 插件 - 切换 wpautop

    转到设置 -> 写作 -> 自动禁用新帖子

    Go to Settings -> Writing -> Auto disable new posts

    即使帖子在网站上显示正常,如果您保存帖子,它也会在编辑器中格式化内容.要禁用在 functions.php

    Even though the post displays fine on website, If you save the post it will format the content in the editor. To disable add this in functions.php

    function skp_disable_wp_editor_formatting()
    {
        remove_filter('the_editor_content', 'wp_htmledit_pre');
        remove_filter('the_editor_content', 'wp_richedit_pre');
    }
    add_action( 'media_buttons', 'skp_disable_wp_editor_formatting');
    

  • 就是这样.

    这篇关于Wordpress 管理编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆