您的位置:首页 > 运维架构 > 网站架构

网站调用Wordpress函数,显示博客列表以文章

2011-01-04 11:34 316 查看
调用文章:

<?php
//导入wordpress设置文件
define('WP_USE_THEMES', false);
require('wordpress/wp-blog-header.php');
query_posts('showposts=2'); //设置显示两篇文章
while (have_posts()): the_post();
?>
<li>
<a href="<?php the_permalink(); ?>" target="_blank" style=" color:#000">
<?php echo mb_strimwidth(strip_tags(apply_filters('the_title', $post->post_title)), 0, 50," "); ?></a>
<span class="date"> Posted on <?php echo mysql2date('j.m.Y', $post->post_date); ?></span></p>					<p>
<?php echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 400," ") ?></p>						</li>
<?php
endwhile;
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: