php初心者です。
ニュース一覧で記事を年号順をしたいです。
2016
2016年のニュース群
2015
2015年のニュース群
のように並べたいのですが、うまくできません
http://qiita.com/noqua/items/a26cfcb378300ba20bb1
こちらの記事を参考にコードを書いてみたのですが、画面が真っ白になり、途方に暮れております。
<div class="container archive-items">
<div class="row clearfix">
<?php
$knowledge_id = get_cat_ID('KNOWLEDGE BASE');
$args = array(
'cat' => -$knowledge_id,
'posts_per_page' => 8
);
$loop = new WP_Query( $args );
$count = 1;
while($myQuery->have_posts()) : $myQuery->the_post();
$cat = get_the_category();
$cat_slug = $cat[0]->cat_name;
if($cat_slug == "イベント"){
$cat_name = 'events';
}else if($cat_slug == "news"){
$cat_name = 'news';
}else if($cat_slug == "プレスリリース"){
$cat_name = 'press';
}else{
$cat_name = 'news';
}
?>
<div class="col-sm-3">
<div class="news-content <?php echo $cat_name; ?>">
<div class="info">
<span class="cat-name"><?php echo $cat_name; ?></span>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<span class="date">
<?php the_time('Y年Fd日');?>
</span>
</div>
<div class="desc-area">
<p class="desc">
<?php echo get_the_excerpt(); ?>
</p>
<div class="text-center"><a href="<?php the_permalink(); ?>" class="link-box more-article1">記事を見る</a></div>
</div>
</div>
</div>
<?php endwhile; endif; ?>
</div>
<div class="paginate-content">
<p class="paginate">
<?php
global $wp_rewrite;
$paginate_base = get_pagenum_link(1);
if (strpos($paginate_base, '?') || ! $wp_rewrite->using_permalinks()) {
$paginate_format = '';
$paginate_base = add_query_arg('paged', '%#%');
} else {
$paginate_format = (substr($paginate_base, -1 ,1) == '/' ? '' : '/') .
user_trailingslashit('page/%#%/', 'paged');;
$paginate_base .= '%_%';
}
echo paginate_links( array(
'base' => $paginate_base,
'format' => $paginate_format,
'total' => $myQuery->max_num_pages,
'mid_size' => 1,
'current' => ($paged ? $paged : 1),
'next_text' => ' ',
'prev_text' => ' '
));
?>
</p>
</div>
</div>
現在のコードは上記で、このコードに年号の出力を付け加えたいと思っています。
よろしくお願いします。。