0
我正在尋找一種方法從我的某個頁面獲取the_content並將其顯示在另一個頁面中。最好使用頁面塊/標題。從一個頁面獲取the_content並在另一個頁面中顯示(Wordpress)
我發現了一個代碼,似乎工作,但它使用頁面ID。有沒有辦法修改這段代碼,以便它使用頁slu /標題?
<div>
<?php
$id = 238;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>
</div>
謝謝。
的名字你的意思是網頁塊或標題?檢查[get_page_by_title](https://codex.wordpress.org/Function_Reference/get_page_by_title)out – d79
它可以是slu or或標題@ d79 – chrisbedoya