サイトのカテゴリ表示を格好よく!
Equilibrium Wordpress Themeでは、トップページはかっこ良くても、カテゴリ等を押したときにイマイチなので、少し修正しました。
この修正により、カテゴリ選択時でも、トップページのサムネイルのように格好よく表示されるようになります。
かなりソースコードが汚いので恥ずかしいのですが、こんな感じです。

どんな部分を変更したかといいますと、
テーマの中にある、archive.php ファイルです。
PHP:
-
<?php get_header(); ?>
-
<div class="content">
-
<?php if (have_posts()) : ?>
-
-
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
-
<?php /* If this is a category archive */ if (is_category()) { ?>
-
<h2> ‘<?php single_cat_title(); ?>’ カテゴリ</h2>
-
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
-
<h2>Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
-
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
-
<h2>Archive for <?php the_time('Y.m.d'); ?></h2>
-
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
-
<h2>Archive for <?php the_time('Y.m'); ?></h2>
-
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
-
<h2>Archive for <?php the_time('Y'); ?></h2>
-
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
-
<h2>Author Archive</h2>
-
<h2>Blog Archives</h2>
-
<?php } ?>
-
-
-
<!-- 表示変更 -->
-
<?php foreach((get_the_category()) as $c_v) {
-
$c_v ->cat_ID ;
-
}
-
$cat_id_v = $c_v->cat_ID;
-
-
query_posts($query_string."&cat=${cat_id_v}&showposts=12"); ?>
-
<?php while (have_posts()) : the_post(); ?>
-
<div class="latest-post-wrap">
-
<div class="latest-post">
-
<div class="latest-title">
-
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
-
</a></h2>
-
</div>
-
<div class="latest-image">
-
<?php image_attachment('image', 162, 118, apply_filters('the_permalink', get_permalink())); ?>
-
</div>
-
</div>
-
<div class="latest-content">
-
<div class="postMeta-front"><span class="date"><?php the_time('Y.m.d A h:i') ?></span><span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span></div> <div class="clear"></div>
-
<p><?php
-
$excerpt = get_the_excerpt();
-
?></p>
-
<p class="moretext"><a href="<?php the_permalink() ?>">続きを読む...</a></p>
-
</div>
-
</div>
-
-
-
-
<?php endif; ?>
-
</div>
-
<?php get_sidebar(); ?>
-
<div class="clear"></div>
-
<?php get_footer(); ?>