<ul>
<?php $post_query = new WP_Query(‘showposts=10′);
while ($post_query->have_posts()) : $post_query->the_post();
$do_not_duplicate = $post->ID; ?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>
<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();?>
</ul>
<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无插件调用**、热门、随机文章实例代码》的一些看法。更多内容请查看本栏目更多内容!
comments_template()(获取评论模板) comments_template() 函数用来获取评论模板,普通只能用在文章或许页...
明天,特带来了5个实例技巧,至多能够协助冤家们在缩小wordpress博客的负荷上起到一点点作用吧,上面和网友...
本文实例讲述了WordPress完成网站投稿者也能够上传图片的办法。分享给大家供大家参考。详细剖析如下: Word...
本文实例讲述了wordpress完成获取父类分类称号的办法。分享给大家供大家参考。详细剖析如下: 在wordpress中...
依据最新音讯,到了2014年病毒增长规模初次成为近年来的高点,这阐明如今的网络平安并没有设想中那么强...
此前,咱们只晓得给WordPress文章增加版权申明,文章标签、相干日志,但很少思考到把这些信息输入到Feed中。...