<p class="widget" id="diary1">
<h3>随机出现</h3>
<ul>
<?php
$args=array(
'numberposts'=>16,
'category'=>'-9,-12',
'orderby'=>'rand'
);
$rand_posts = get_posts($args);
foreach( $rand_posts as $post ) :
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</p>
$args=array(
'numberposts'=>16,
'category'=>'-9,-12',
'orderby'=>'rand'
);
<?php $args = array(
'posts_per_page' => 5,
'numberposts' => 5,
'offset' => 0,
'category' => '',
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish',
'suppress_filters' => true );
?>
以上就是安达网络工作室关于《wordpress get_posts函数的使用方法 禁止输出指定类别的文章》的一些看法。更多内容请查看本栏目更多内容!
上一篇,咱们应用 Meta Box 为文章增加了一个“推荐指数”字段。增加后用了一段工夫,仿佛不那么...
在wordpress模板制造进程中,有一些貌似复杂的成绩,其实只需确定了成绩呈现的地位,大少数都能够自行处理。...
关于伪动态的成绩,置信用 WordPress 的冤家都会很相熟 WP-Cache 这款插件了,不只由于它出众的功能使其简直...
找到wp-includes/comment-template.php文件中 复制代码代码如下:if ( empty( $url ) || 'http://' == $url ...
WordPress菜单CSS类选项设置办法: 1、点开WordPress菜单设置页面右上角“显示选项”,勾选外面的...
1.用分类做为导航拦 <?php wp_list_categories('depth=2&title_li=0&orderby=name&show_count=0');?> 把这句...