[英]Bootstrap auto generate <p> tag in Wordpress
Because the_content() will always wrap the content with a <p>
tag.因为 the_content() 将始终用
<p>
标记包装内容。
You can use get_the_content() insted of the_content() but using get_the_content() will give you the content without any shortcodes or embedded media as mentioned at codex .您可以使用 get_the_content() insted of the_content() 但使用 get_the_content() 将为您提供没有任何短代码或嵌入媒体的内容,如codex所述。
This is another solution to get exactly what you want:这是获得您想要的东西的另一种解决方案:
<?php
$content = get_the_content();
$content = apply_filters('the_content', $content);
$replace = '<p class="discription">';
echo str_replace('<p>', $replace, $content ); ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.