<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无插件调用**、热门、随机文章实例代码》的一些看法。更多内容请查看本栏目更多内容!
找到wp-includes/formatting.php文件中复制代码代码如下:// This is not a tag, nor is the texturization ...
喜爱折腾修正Wordpress主题的冤家,一定遇到过这样的成绩,想在首页文章中显示缩略图,有插件能够完成,不过...
去掉logo或许左侧栏的菜单,避免被改掉。 在应用模板下的functions.php下修正 复制代码代码如下: function ...
处理办法这是由于空间中的’C:\WINDOWS\TEMP’目录没有设置IIS拜访权限,需求空间商为你设置目录...
用到了WordPress性能函数Query_post()的一种初级用法,就是获取本周或当月或最近30天评论最多的肯定数量的日...
comments_template()(获取评论模板) comments_template() 函数用来获取评论模板,普通只能用在文章或许页...