<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-postviews这款插件的支持代码,凑巧笔者的Green Park 2这款...
首先需求在主题的function.php文件里增加一段函数: 复制代码代码如下: < ?php function fail($s) { header...
家喻户晓,wordpress是基于php开发,在apache效劳下运转是最优秀的。然而,国际依然有很多主机上不能提供ap...
1. 装置 Docker 在咱们真正开端之前,咱们需求确保在咱们的 Linux 机器上曾经装置了 Docker。咱们应用的主机...
本文实例讲述了WordPress首页显示多个图片及文字友谊链接的办法。分享给大家供大家参考。详细剖析如下: Wo...