<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无插件调用**、热门、随机文章实例代码》的一些看法。更多内容请查看本栏目更多内容!
上面引见四种WordPress 显示文章摘要办法: 一、应用WordPress自带摘要性能 我目前另一WordPress博客就是应...
wordpress头部的代码十分多,包括WordPress版本,前后文、第一篇文章、主页meta信息等各种冗余代码,这些对...
给一篇好的文章增加一些分享按钮分享到一些知名网站,很利于网站的推行。给站点增加分享按钮的办法很多,你...
通常咱们喜爱应用Wordpress Thread Comment 或 Mail To Commenter这两款插件前者久未更新,已测支持WordPre...
WordPress主题教程之修正wordpress回复评论文字办法,首选需求建设个自定义的评论模板,而后经过调用此...
comments_template comments_template 函数是一个调用评论模板的函数,应用起来很简略,与get_header()等函...