function widget($args, $instance) { extract($args); ?> <?php echo $before_widget; ?> <h3 class="widget-title"><?php echo $instance['title']; ?> </h3> <div class="widget-line"></div> <ul class="catPost"> <?php $post_tags = wp_get_post_tags($post->ID); if ($post_tags) { foreach ($post_tags as $tag) { // 获取标签列表 $tag_list[] .= $tag->term_id; } } $post_tag = $tag_list[rand(0, count($tag_list) - 1)]; $query_posts = new WP_Query('orderby=rand&caller_get_posts=1&showposts=' . $instance['Num'] . '&tag_in=' . $post_tag); ?> <?php while ($query_posts->have_posts()) { $query_posts->the_post(); ?> <?php if ($instance['style'] == "img") { ?> <li class="imglist"><a href=" <?php the_permalink(); ?> " title=" <?php the_title(); ?> "> <?php if (dopt('Rcloud_timthumb_b')) { post_thumbnail(145, 90); } else { the_img(); } ?> <?php the_title(); ?> </a></li> <?php } elseif ($instance['style'] == "text") { ?> <li class="textlist"><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></li> <?php } } ?> </ul> <?php echo $after_widget; ?> <?php }
<span class="fr"><?php the_time('m月d日'); ?> </span> <div class="cc"></div> <div class="line"></div> </h2> <?php if (get_the_img()) { echo '<div class="post-list-img"><a href="' . get_permalink() . '" title="' . get_the_title() . '">'; the_img(); echo '</a></div>'; } ?> <div class="post-list-text"><?php the_excerpt(); ?> </div> <ul class="post-list-info"> <li class="cat">分类:<?php the_category(' '); ?> </li>