如何在WordPress博客文章中插入HTML代码块 [英] How to insert an HTML code block in a WordPress blog post

查看:1223
本文介绍了如何在WordPress博客文章中插入HTML代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用WordPress撰写了一篇博客文章,并在发布之前检查了其预览,并注意到我在博客文章中添加的HTML代码中的格式发生了奇怪的变化,从而转换(编码)了<和>字符添加到它们的(& lt)和(& gt)中.

I had written a blog post in WordPress and checked its preview before publishing and noticed a strange format change in the HTML code I have added in my blog post, converting (encoding) the < and > characters into their (&lt) and (&gt).

我可以添加一个插件来按原样显示代码吗?

Is there a plugin I can add for displaying the code as it is?

推荐答案

经过我的前辈的长期研究和帮助,我得到了此解决方案,用于限制WordPress将<>字符转换(编码)为他们的(& lt)和(& gt)等效项:

After a long research and help from my seniors, I got this solution for restricting the WordPress from converting (encoding) the < and > characters into their (&lt) and (&gt) equivalents:

您可以使用:

<pre class="lang:html decode:true ">
    /* Some HTML code here */
</pre>

这篇关于如何在WordPress博客文章中插入HTML代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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