我正试着组建但却没有运气。我的代码如下所示
global $post;
$content = $post->post_content;
在这里输出
'.$content.'
如果有人有建议,请告诉我。
发布于 2018-04-05 10:09:14
如果我把你的问题做对了,你希望post_content格式像the_content发布的内容一样,对吗?
修改上面的代码如下:
global $post;
$content = apply_filters('the_content',$post->post_content);
这将对the_content()输出内容时执行的所有内容进行处理;
如果您只需要p和b标记,则可以使用wpautop($post->post_content)
。
https://wordpress.stackexchange.com/questions/299888
复制相似问题