Skip to content

Instantly share code, notes, and snippets.

@megane9988
Created July 21, 2013 14:03
Show Gist options
  • Save megane9988/6048659 to your computer and use it in GitHub Desktop.
Save megane9988/6048659 to your computer and use it in GitHub Desktop.
<!-- 記事があるかどうか -->
<?php if (have_posts()): ?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- 全体をaでくくる -->
<a href="<?php the_permalink(); ?>" class="post-set">
<!-- アイキャッチのあるなし -->
<?php if (has_post_thumbnail( $post_id = null )): ?>
<p class="post_thumbnail">
<?php the_post_thumbnail( $size = 'thumbnail', $attr = '' ); ?>
</p>
<?php else:?>
<p class="post_thumbnail"><img src="http://dummyimage.com/150x150/000/fff" alt=""></p>
<?php endif; ?>
<!-- 日付、タイトル、category -->
<br>
<?php echo get_the_date();?>
<br>
<?php echo the_title(); ?>
<br>
<?php
$cat = get_the_category();
$tmparray = array();
foreach( $cat as $c )
$tmparray[] = $c->cat_name;
echo implode( ', ', $tmparray );
?>
</a>
<?php endwhile; ?>
<?php else: ?>
<!-- 記事がないとき -->
記事がないお
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment