wordpress调用最新、热门、随机文章
2013-11-25 16:40
260 查看
调用最新文章:
省略
” href=””>
调用热门文章:
$post_num = 14; // 设置调用条数
$args = array(
‘post_password’ => ”,
‘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(); ?>
” title=””>
调用随机文章:
global $post;
$postid = $post->ID;
$args = array( ‘orderby’ => ‘rand’, ‘post__not_in’ => array($post->ID), ‘showposts’ => 14);
$query_posts = new WP_Query();
$query_posts->query($args);
?>
have_posts()) : $query_posts->the_post(); ?>
” title=””>
省略
” href=””>
调用热门文章:
$post_num = 14; // 设置调用条数
$args = array(
‘post_password’ => ”,
‘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(); ?>
” title=””>
调用随机文章:
global $post;
$postid = $post->ID;
$args = array( ‘orderby’ => ‘rand’, ‘post__not_in’ => array($post->ID), ‘showposts’ => 14);
$query_posts = new WP_Query();
$query_posts->query($args);
?>
have_posts()) : $query_posts->the_post(); ?>
” title=””>
相关文章推荐
- WordPress无插件调用最新、热门、随机文章
- WordPress无插件调用最新、热门、随机文章
- wordpress调用最新、热门、随机文章
- wordpress调用最新、热门、随机文章
- ECShop在任何页面调用最新文章并变成随机文章
- wordpress提取文章(最新,最热,随机)
- Zen-cart产品页面随机调用Wordpress文章
- zencart产品页面调用WordPress最新文章
- WordPress分类最新文章调用代码
- wordpress调用最新文章列表代码
- 在wordpress中调用某分类中的最新文章,兼谈wordpress的分类方法
- 外部调用zblog最新文章和随机文章
- ecshop首页调用wordpress最新文章并支持伪静态链接
- zencart产品页面调用WordPress最新文章
- 易企建站系统如何调用wordpress最新文章?
- arclist标签在文章页列表页调用所有(全站)栏目最新文章热门文章的方法 [复制链接]
- 黄聪:如何不用插件使用代码调用Wordpress中的随机文章。
- 外部调用ZBLOG最新和随机文章的方法(已经更新)
- arclist标签在文章页列表页调用所有(全站)栏目最新文章热门文章的方法
- dedecms首页调用随机文章全自动时时更新