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

爱吾下载站

当前位置:爱吾下载 > 源码技巧 > wordpress > WordPress无插件调用热门文章的方法

WordPress无插件调用热门文章的方法

发表时间:2015-09-07 13:46作者:fang人气:更新时间:2025-10-06 23:13:48

<ul>

<?php

$post_num = 10; // 设置调用条数

$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(); ?>

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

<?php } wp_reset_query();?>

标签WordPress,插件,调用,热门,文章,方法,php,p

相关下载

查看所有评论+

网友评论

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

热门阅览

最新排行

公众号