2010-03-25 142 views

回答

9

看看到Integrating WordPress with your Website

这是从该网页,显示按字母顺序排列的前十个职位的例子:

<?php 
require('/the/path/to/your/wp-blog-header.php'); 
?> 

<?php 
$posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); 
foreach ($posts as $post) : start_wp(); ?> 
<?php the_date(); echo "<br />"; ?> 
<?php the_title(); ?>  
<?php the_excerpt(); ?> 
<?php 
endforeach; 
?> 

如果您需要10个最新帖子,请使用$posts = get_posts('numberposts=10');

+0

+1,最佳答案。 – 2010-03-25 14:30:04

0

也许最简单和最优雅的方法是创建一个自定义主题,以生活在summary.php上。 WP库提供了许多功能,可以轻松输出文章。

0

我想你已经回答了你自己的问题。 RSS提要会为您提供最新帖子的内容。

没有太大的工作,你可以只拉出来的数据,你需要

0

可以包括WP-config.php文件,将在API的其余部分拉。那么你将能够使用WP的功能,如

function get_post($postID) 
相关问题