A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > wordpress > WordPress无插件调用随机文章的方法

WordPress无插件调用随机文章的方法

时间:2015-09-07 13:45作者:fang人气:43

<ul>

<?php

global $post;

$postid = $post->ID;

$args = array( 'orderby' => 'rand', 'post__not_in' => array($post->ID), 'showposts' => 10);

$query_posts = new WP_Query();

$query_posts->query($args);

?>

<?php while ($query_posts->have_posts()) : $query_posts->the_post(); ?>

<li><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>

<?php endwhile; ?>

</ul>

标签WordPress,插件,调用,随机,文章,方法,php,g

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

热门阅览

最新排行

公众号