wordpress调用随机文章的代码

chen'mo
2013-11-15 / 0 评论 / 7,311 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于1970年01月01日,已超过19839天没有更新,若内容或图片失效,请留言反馈。

有些wordpress博主喜欢在文章内容的结尾或者侧边栏随机调用几篇文章,以提高网站的粘性,也利于seo。

wordpress随机文章的调用代码如下:


<?php query_posts(array('orderby'=>'rand','posts_per_page'=>10,'ignore_sticky_posts'=>true)); while(have_posts()): the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(array('before'=>'查看 ','after'=>' 的文章')); ?>"><?php the_title(); ?></a>
<?php endwhile; wp_reset_query();  ?>

0
知道这些你就老了:那些属于曾经的网站
« 上一篇 11-14
wordpress插件Ecall-js方式外部调用wordpress文章
下一篇 » 11-15

评论 (0)

插入图片