WordPress内容未正确显示使用the_content()
我遇到了同样的问题在Stackoverflow上,但给出的答案不起作用。我。我面临与此链接中提到的同一问题,我的内容如下:
任何人都可以指导我如何指导我解决这个问题?只要我没有向其添加the_content()
,我的头版就可以了。
I came across the same question on StackOverflow but the answer given to it is not working for me. I am facing the same issue as mentioned in this link and my content is showing like this:
Can anyone guide me on how to solve this issue? My front page was fine as long as I had not added the_content()
to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在,请按照wp块编辑器中的列块从前端更新前端,以实现您想要的东西。
Rather than updating from frontend using css ,now follow the columns blocks in WP Block Editor to achieve what you want .
因此,最后我找到了这个问题背后的原因。当我使用Inspect看到浏览器中显示的页面代码时,我发现无论在哪里使用the_content()WordPress实际上是通过将内容插入HTML代码中的内容,为:
内容仅在哪里:
没有得到原因可能是由于某个插件或其他原因引起的,因为我没有在functions.php中使用add_filter(“ the_content”,“ the_content”,noyfuncname')将任何html添加到$ content.php中,但用于解决此问题问题,然后我将add_filter添加到functions.php as:
因此:我使用了php的strip_tags()函数作为剥离字符串,这是$ content的主要内容。因此,这就是我解决这个问题的方式。
希望这个答案将来会帮助别人
So finally I found the reason behind this issue. When I saw the code of page displayed in the browser using inspect then I found that wherever I was using the_content() WordPress was actually inserting content by enclosing it within HTML code as:
where the content was only:
Did not get the reason why it occurred may be due to some plugin or some other reason as I was not adding any HTML to $content using add_filter("the_content",'anyfuncname') in functions.php but for solving this issue, I then added add_filter to functions.php as:
So I used the strip_tags() function of PHP for stripping string which was the main content from $content. So this is how I solved this issue.
Hope this answer will help someone else in future