用ID保留段落回复帖子
每当我尝试回复帖子的内容时,我会得到没有html标签的内容。像段落一样。用ID保留段落回复帖子
有没有一种方法来回显他们与段落等?
现在这是我的PHP代码:
$post_id = 1231;
$queried_post = get_post($post_id);
echo $queried_post->post_content;
使用the_content();
或echo get_the_content();
由于此功能使用WP过滤器the_content
,该过滤器使用 'wpautop' 过滤器。
哪些广告p
标签
这里是扣
<?php
$post_id = 1226;
$post_local = get_post($post_id);
if($post_local){
setup_postdata($post_local);
echo wp_autop(get_the_content());
}
?>
当我像这样使用它时,没有任何反应。你能告诉我我做错了什么吗? :) 谢谢! $ post_id = 1226; 回声get_the_content($ POST_ID) – Philip 2015-02-23 11:23:06
这对我的作品,但这种方法可能有点过时: $ my_postid = 12; //这是网页ID或交ID $ content_post = get_post($ my_postid); $ content = $ content_post-> post_content; $ content = apply_filters('the_content',$ content); $ content = str_replace(']]>',']] >',$ content); echo $ content; – Philip 2015-02-23 11:24:40
当我使用捕捉它仍然剥离P标签:/ Hmzz – Philip 2015-02-23 11:31:10
这个工作对我来说:
$post_id = 1226;
echo apply_filters('the_content', get_post_field('post_content', $post_id));
Can你提供任何你想要实现的例子吗? – 2015-02-23 11:07:53
这是它在实际页面上的样子: http://i60.tinypic.com/14jnlt5.png 但是,当我尝试在另一页上显示该页面的内容时, : http://i62.tinypic.com/11hgvgg.png 我读过应用过滤器,但没有运气。我有麻烦用我自己的例子。 apply_filters('the_content',$ post-> post_content); – Philip 2015-02-23 11:18:09