<ul id="popular-post">
<?php $args=array(
'posts_per_page'=>5,
'orderby' => 'comment_count',
); ?>
<?php $my_query = new WP_Query($args); ?>
<?php if( $my_query->have_posts() ) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>"><?php the_title(); ?></a>
<span><?php the_time("Y n d") ?></span><br />
<span><?php comments_number('0', '1', '%' ); ?></span>
<?php $justanimage = get_the_post_thumbnail($post->ID, 'thumbnail') ?>
<?php if ($justanimage) : ?>
<?php the_post_thumbnail($post->ID, 'thumbnail'); ?>
<?php else : // 画像がない場合の代替え画像 ?>
<img src="http://an-alternative-image.jpg" alt="" />
<?php endif; ?>
</li>
<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>
</ul>
http://webdesignrecipes.com/22-wordpress-customize-hack/
目次
