假设WP安装在blog目录,在主页调用博客的文章,也是最多的情况
<?php
define('WP_USE_THEMES', false);
require('blog/wp-blog-header.php'); //修改博客的路径
query_posts('showposts=20'); //显示文章条数
?>
<?php while (have_posts()): the_post(); ?>
<li><a href="<?php the_permalink(); ?>" target="_blank"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title', $post->post_title)), 0, 50," "); ?></a></li>
<?php endwhile; ?>