function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); // the widget title $post_num = $instance['post_num']; // the type of posts to show // Before widget // echo $before_widget; // Title of widget // if ($title) { echo $before_title . $title . $after_title; } // Widget output // $args = array('post_type' => 'post', 'posts_per_page' => $post_num, 'meta_key' => 'recommend_post', 'meta_value' => 'on', 'orderby' => 'rand'); $recommend_post = new WP_Query($args); if ($recommend_post->have_posts()) { ?> <ol class="widget_post_list"> <?php $options = get_desing_plus_option(); while ($recommend_post->have_posts()) { $recommend_post->the_post(); ?> <li class="clearfix"> <?php if (has_post_thumbnail()) { ?> <a class="image" href="<?php the_permalink(); ?> "><?php the_post_thumbnail('size2'); ?> </a> <?php } else { ?> <p class="post_date"><span class="date"><?php the_time('j'); ?> </span><span class="month"><?php $month = get_the_date('M'); if (strtoupper(get_locale()) == 'JA') { echo encode_date($month); } else { echo $month; } ?> </span></p> <?php } ?> <h4 class="title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <?php if (has_post_thumbnail()) { ?> <p class="post_date2"><?php the_time('Y.m.d'); ?> </p><?php } ?> </li> <?php } ?> </ol> <?php } else { ?> <p><?php _e("There is no registered post.", "tcd-w"); ?> </p> <?php } wp_reset_postdata(); // After widget // echo $after_widget; }
"><?php the_post_thumbnail('size1'); ?> </a> <?php } ?> <div class="info clearfix"> <div class="meta clearfix"> <p class="post_date"><span class="date"><?php the_time('j'); ?> </span><span class="month"><?php $month = get_the_date('M'); if (strtoupper(get_locale()) == 'JA') { echo encode_date($month); } else { echo $month; } ?> </span></p> <ul<?php if ($options['show_comment']) { echo ' class="no_comment"'; } ?> > <li class="archive_date"><?php the_time('Y', 'tcd-w'); ?> </li>