0
我添加了一個自定義的PHP函數,我的wordpress模板,在這裏我想呼應的頁面一定母公司下的內容:WordPress的PHP內容格式
Departments
-department 1 (get the title and the content clean)
-department 2 (get the title and the content clean)
(...)
我到目前爲止的代碼不工作,我希望,標題是好的,但我需要過濾的內容,所以我只能抓住"<p>"
標籤之間的文本。這可能嗎?謝謝。
的functions.php
function echo_childs_of($postID) {
$args = array(
'order' => 'ASC',
'post_parent' => $postID,
'post_status' => null,
'post_type' => 'any'
);
$page_childs = get_children($args);
if ($page_childs) {
foreach ($page_childs as $child) {
$title = get_the_title($child);
$content = get_the_content($child);
$content = strip_shortcodes($content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
echo $title;
echo $content;
}
}
}
我的PHP頁面上
echo_childs_of(7);
@PeterSmith我得到的錯誤:**無法加載資源:服務器迴應500(內部服務器錯誤)的狀態** –
的http:// pastebin.com/raw/zFF7zu93 –