2
A
回答
4
<?php $page = get_page(); // gets current page ID
$parentID = $page['post_parent']; // gets parent ID, if there is one
if($parentID != '0') {
$parentPage = get_page($parentID);
$parentContent = $parentPage['post_content']; // gets raw content
$parentContent = apply_filters('the_content', $parentContent); // filters content
} ?>
這是做到這一點的方法之一。
2
$parent = get_post($post->post_parent);
那麼你可以做
$parentContent = $parent->post_content
僅供參考,get_page()
包裹get_post()
相關問題
- 1. WordPress的頁面父模板
- 2. 頁面的WordPress內容模板?
- 3. 獲取頁面內容與WordPress的
- 4. 獲取wordpress父模板名稱
- 5. MVC2 - 如何獲取模板內的父模型(容器)
- 6. Wordpress中的模塊化頁面內容
- 7. WordPress的頁面模板
- 8. Ruby獲取頁面內容
- 9. Wordpress靜態頁面:如何將內容嵌入到模板中?
- 10. Plone的4:獲取頁面的父在portlet模板
- 11. 在Wordpress模板的其他地方使用Wordpress頁面的內容
- 12. WordPress的:從另一個頁面獲取指定的內容
- 13. 製作模板頁面wordpress
- 14. 獲取特定頁面的內容在WordPress
- 15. Django cms在父模板中獲取內容變量
- 16. WordPress的獲取模板URL
- 17. jQuery的:獲取父內容
- 18. 頁面內容超過頁腳WordPress的
- 19. WPF:獲取其父面板
- 20. JLabel - 獲取父面板?
- 21. 從模板中獲取塊內容
- 22. WPF:從內容獲取Tabtitle(模板中)
- 23. 無法從模板獲取內容
- 24. WordPress的首頁不顯示模板的內容
- 25. 設置頁面模板WordPress的
- 26. WordPress的頁面模板不渲染
- 27. WordPress頁面模板中的圖片
- 28. Wordpress中的自定義頁面模板
- 29. WordPress的自定義頁面模板
- 30. WordPress的:頁面使用類別模板
這是偉大的,謝謝:) – 2012-09-25 15:26:46