使用wordpress禁止输出指定类别的文章可以给get_posts()函数传个数组参数,如下:<div class="msgborder" id="PHPcode3"><div class="widget" id="diary1">
随机呈现
- <?php $args=array( 'numberposts'=>16, 'category'=>'-9,-12', 'orderby'=>'rand' ); $rand_posts = get_posts($args); foreach( $rand_posts as $post ) : ?>
- <a href="<?php the_permalink(); ?>"><?php the_title(); ?> <?php endforeach; ?>