主页 > 编程资料 > WordPress >
发布时间:2015-09-26 作者:网络 阅读:181次
调用最新文章:

复制代码代码如下:

    while ($post_query->have_posts()) : $post_query->the_post();
    $do_not_duplicate = $post->ID; ?>
  • ”>




调用热门文章:

复制代码代码如下:

    $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(); ?>
  • ” title=””>




调用随机文章:

复制代码代码如下:

    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);
    ?>
    have_posts()) : $query_posts->the_post(); ?>
  • ” rel=”bookmark” title=””>



关键字词: