filters - how to output HTML tags in post_content and not as plain text

Currently I have a post with <strong> and <em> tags, and <p> tags. But they all seem to be being outpu

Currently I have a post with <strong> and <em> tags, and <p> tags. But they all seem to be being outputted as plain text, and not formatted HTML

I am using laravel blade as my templating engine. I currently have:

@php
   $page = get_page_by_title( 'Test Page' );
   $content = apply_filters( 'the_content', $page->post_content );
@endphp

Which outputs:

<p>This is a test page for development practice.</p> <p>Here is another line etc</p> <p><strong>BOLD TEXT</strong></p> <p><em>ITALIC TEXT</em></p>

When it needs to be:

This is a test page for development practice.

Here is another line etc

BOLD TEXT

ITALIC TEXT

This answer: How to output only the post content suggests to use apply_filters( 'the_content', $post->post_content ); which is what I'm currently doing

how do you have content outputted as HTML and not plain text?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745188356a4615743.html

相关推荐

  • filters - how to output HTML tags in post_content and not as plain text

    Currently I have a post with <strong> and <em> tags, and <p> tags. But they all seem to be being outpu

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信