<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无插件调用**、热门、随机文章实例代码》的一些看法。更多内容请查看本栏目更多内容!
header_image() header_image() 函数是 WordPress 自定顶部图像的规范接口函数,该函数能够主动判别后盾设置...
首先列表会变得很臃肿,得到了列表的自身作用——不便用户寻觅真正想要看的帖子,其次,在搜寻引...
1、主动向 WordPress 编辑器拔出文本 编辑以后主标题录的 functions.php 文件,并粘贴以下代码: 复制代码代...
明天发文章时,惊奇的发现文章的ID居然曾经抵达了19了。鉴于我以前折腾Wordpress的经历,我晓得这是Wordpre...
本文实例讲述了WordPress完成搜寻后果包括自定义文章类型内容的办法。分享给大家供大家参考。详细剖析如下:...
WordPress改换空间后 需求调整的几个中央? 1.数据库衔接配置文件 wp-config.php 2.查看.htaccess文件,并修...