新しい順に3つ表示(最終)

<div id="indexcontent">
<ul id="new-post">
<?php $args=array(
'posts_per_page'=>3,
'orderby' => 'post_date',
); ?>
<?php $my_query = new WP_Query($args); ?>
<?php if( $my_query->have_posts() ) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li class="entry-header">
<h1 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>"><?php echo mb_substr($post->post_title, 0, 10).'...'; ?> </a></h1>
<div class="entry-meta">投稿日:
<?php the_time('Y年n月j日') ?>
<br />
投稿者:<a href="http://○○○○○○.jp/author/<?php the_author(); ?>">
<?php the_author(); ?>
</a><br />
カテゴリー:
<?php the_category(' '); ?>
</div>
<div class="comments-link"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>">
<?php comments_number('0', '1', '%' ); ?>
</a></div>
<?php $justanimage = get_the_post_thumbnail($post->ID, 'thumbnail') ?>
<?php if ($justanimage) : ?>
<?php the_post_thumbnail( array(50,50) ); ?>
<?php else : // 画像がない場合の代替え画像 ?>
<img src="http://○○○○○.jp/images/noimg.gif" alt="イメージはありません" />
<?php endif; ?>
<?php echo mb_substr(strip_tags($post-> post_content), 0, 20).'...'; ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>"> <br />
▼続きを読む</a > </li>
<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>
</ul>
<a href="http://○○○○○○○.jp/category/all/">もっと見る</a></div>

 

見ていただいてありがとうございます。↓ポチしてくださいませ。
  • 見た (0)
  • もう少し詳しく書いて! (0)
  • 見たけど役立たず (0)
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

コメント

コメントする

目次