代码描述:
一、调用最新文章
// 显示篇数和排除分类
二、调用指定分类文章
三、调用整站随机文章
ID;
$args = array( ‘orderby’ => ‘rand’, ‘post__not_in’ => array($post->ID), ‘showposts’ => 10); // 显示篇数
$query_posts = new WP_Query();
$query_posts->query($args);
?>
have_posts()) : $query_posts->the_post(); ?>
四、调用同分类随机文章
四、调用同分类随机文章
五、调用整站热门文章(按评论数)
-
上一篇
【WordPress,ripro教程】复制内容文字弹出版权提示 下一篇
【WordPress教程,ripro教程】为博客添加鼠标点击特效
”,
‘post_status’ => ‘publish’, // 只选公开的文章.
‘post__not_in’ => array($post->ID),//排除当前文章
‘caller_get_posts’ => 1, // 排除置顶文章.
‘orderby’ => ‘comment_count’, // 依评论数排序.
‘posts_per_page’ => $post_num
);
$query_posts = new WP_Query();
$query_posts->query($args);
while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>