0
我需要將帖子縮略圖的帖子標題,日期和內容(或摘錄)全部放在一起,同時分別獲取url和圖片src。我正在解決這個查詢:如何在Wordpress之外獲取張貼縮略圖?
SELECT * FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY id DESC LIMIT 5
使用上面的查詢,如何獲取帖子縮略圖?我正在通過這種方式檢索所有數據:
<?php
#start a loop that starts $i at 0, and make increase until it's at the number of rows
for($i=0; $i< $num_rows; $i++) {
#assign data to variables, $i is the row number, which increases with each run of the loop
$blog_date = mysql_result($query_result, $i, "post_date");
$blog_title = mysql_result($query_result, $i, "post_title");
$blog_excerpt = mysql_result($query_result, $i, "post_excerpt");
$blog_content = mysql_result($query_result, $i, "post_content");
#$blog_permalink = mysql_result($query_result, $i, "guid"); //use this line for p=11 format.
$blog_permalink = $blog_url . mysql_result($query_result, $i, "post_name"); //combine blog url, with permalink title. Use this for title format
#format date
$blog_date = strtotime($blog_date);
$blog_date = strftime("%b %e", $blog_date);
?>
<div class="post">
<div class="date"><?php echo $blog_date; ?></div>
<h2><a href="<?php echo $blog_permalink; ?>"><?php echo $blog_title; ?></a></h2>
<div class="entry">
<?php echo $blog_excerpt; ?>
</div>
</div>
<?php } #ends loop ?>
謝謝。
的問題是:我需要從另一個域的安裝,完全超出的位置,我需要找回的職位得到職位。 – joaogdesigner 2013-05-02 21:15:35
[檢查此答案](http://stackoverflow.com/questions/12589025/how-to-pull-posts-from-wordpress-to-other-non-wordpress-site-on-different-hostin)。 – 2013-05-02 21:35:45