2010-08-11 34 views
0

我有以下的網站結構 父站點 - >博客(WordPress的) - >獲得,最近-posts.php - >的index.php使用在父網站WordPress的API

我想顯示index.php中最近的帖子列表。我試圖在index.php中使用WordPress的API函數,但它不工作。如果我嘗試直接運行get-recent-posts.php它顯示的帖子,但如果我將它包含在index.php它does not工作。

+0

這是什麼意思「不工作」和「不工作」?任何具體問題? – 2010-08-11 06:25:45

回答

0

將以下代碼添加到頁面頂部即可完成這項工作。路徑應該是您的wp安裝的絕對路徑或相對路徑。

<?php 
require_once '.blog/wp-load.php'; 
> 
0

請更具體的,我個人不明白你通過以下

Parent Site -> blog (wordpress) -> get-recent-posts.php -> index.php 

,如果你想以下設置

http://yoursite.com (where you can access Wordpress functions) 
http://yoursite.com/wordpress (where your blog resides) 

也許這將有助於意思: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory