wordpress中的字符串中未显示新行

时间:2016-08-02 12:39:55

标签: php wordpress post shortcode

我正在使用代码打印标题和内容。标题首先显示,内容显示在下一行。我编写的代码如下

 $title = get_the_title( $id )."<br><br>".get_post_field( 'post_content', $id );

但它只是在输出中打印<br>标记,不会破坏该行。

1 个答案:

答案 0 :(得分:0)

做这样的事,

$title = get_the_title( $id );
$content = get_post_field( 'post_content', $id );
echo $title."<br>".$content;

或the_title();和the_content();