<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函数的使用方法 禁止输出指定类别的文章》的一些看法。更多内容请查看本栏目更多内容!
首先列表会变得很臃肿,得到了列表的自身作用——不便用户寻觅真正想要看的帖子,其次,在搜寻引...
将Gravatar寰球通用头像缓存的目的在于放慢网站的关上速度,由于Gravatar官网的效劳器在国外,加上伟大的GF...
要害字形容:理由 ZBLOG 装置 优化 工夫 WordPress 能够 文章 博客 让我据守ZBLOG的十二大理由: ...
最近关上博客后盾,发现后盾关上速度很慢。 经过开发者调试工具对网络加载进行检测,发现是因为后盾应用了谷...
判别置顶文章 is_sticky() 函数用来判别一篇文章能否为置顶文章。 用法 is_sticky( $post_id ); 参数 $p...
置信很多站长都晓得并且曾经在应用WordPress自定义字段,很多插件也应用了这一性能。 自定义字段是一个十分...