<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函数的使用方法 禁止输出指定类别的文章》的一些看法。更多内容请查看本栏目更多内容!
当然 Wordpress 2.7 里有“小工具”选项也能管制 Widget ,然而重复试验后发现款式无奈对立,可控...
很多时分咱们需求在给 WordPress 文章编辑器设置默许内容,比方把罕用的扫尾或许文章留意事项放出来,本文就...
WordPress默许的头像是读取gravatar.com上的图片的,关于国际用户来说会使网页关上速度变慢。所以我决议删除...
有时分,为了需求,是要获取wordpress以后文章的评论数,要想获取文章的评论数必需要晓得以后文章的id,怎样...
register_sidebar()(创立侧边栏) 建设一个侧边栏,用来搁置小工具。这个函数应用的时分请放在一个函数里,...
WordPress的模板十分灵敏,一个优秀的模板所完成的性能往往超出你的设想。这篇文章说说在WordPress里调用文...