내 WordPress 블로그는 현재 한 달 단위로 아카이브를 보여줍니다. 이처럼 : 2014특정 형식으로 표시하려면 WordPress 보관함이 필요합니다.
11월
년 10 월 2014
년 9 월 2014
년 8 월 2014
년 7 월 2014
년 6 월 2014 2014
월
.....
하고 그렇게
I에 현재 연도가 모든 달을 표시하는 방식으로 표시해야하지만, 그 전년도에는 "연도"만 표시됩니다. 이런 식으로 뭔가 :
년 11 월 2014
년 10 월 2014
년 9 월 2014
...
... 2014
2월
1월
누군가 나를 안내 할 수 있습니까? 내 블로그의 사이드 바에서 현재 코드는 다음과 같이 간다 : 당신은 분명히 문제를 일으키는 wp_get_archives('type=monthly')
이외의 아무것도 사용하지하고
<?php /* If this is a category archive */ if (is_category(0) || in_category(0)) { ?>
<?php ?><ul>
<?php
$querystr = "SELECT YEAR(post_date) AS 'year', MONTH(post_date) AS 'month' , count(ID) as posts FROM $wpdb->posts INNER JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE $wpdb->term_taxonomy.term_id != 12 AND $wpdb->term_taxonomy.parent != 12 AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id =8 AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC";
$years = $wpdb->get_results($querystr);
foreach ((array) $years as $year) {
$url = get_month_link($year->year, $year->month);
$url = $url.'?cat=8';
$date = mysql2date('F o', $year->year.'-'.$year->month, $translate = true);
echo get_archives_link($url, $date, 'html','<li>','</li>');
}
?>
</ul><?php
?>
<?php } else { ?>
<?php wp_get_archives('type=monthly');?>
<?php } ?>
</ul>
</div>
<div class="archive-bottom"></div>
<!-- <div class="clear"></div>-->
<?php } ?>
</div>
훌륭한 작품! 엄청 고마워. 한 가지만 더 (나는 불행하게도 많은 코더가 아니다). "2012 년 게시물"과 같은 것을 읽는 아카이브가 필요하다면 "2012"연도가 표시되는 대신에? –