Wordpress - 不使用<p>包装器显示页面内容</p>

时间:2012-06-27 16:28:51

标签: wordpress wordpress-theming

如何使用<p></p>包装器显示给定页面ID的内容?

我目前使用的方法是:

<?php 
$id=21; 
$post = get_page($id); 
$content = apply_filters('the_content', $post->post_content); 
echo $content;  
?>

例如,page ID = 21具有以下内容:Some content

wordpress echo是<p>Some content</p>

任何建议都非常感谢。

1 个答案:

答案 0 :(得分:5)

如果您不想回复周围的段落标记,只需将<?php remove_filter ('the_content', 'wpautop'); ?>添加到模板页面即可删除过滤器。

相关问题