Someone in the StudioPress Support forums wanted a Category Archive Template that listed categories and posts under that category. For example:
Category 1
- article 1
- article 2
- article n
Category 2
- article 1
- article 2
- article n
So, here it is:
[php]<?php /** * Template Name: Category Archive */ get_header(); ?></p>
<p><?php genesis_before_content_sidebar_wrap(); ?></p>
<div id="content-sidebar-wrap">
<p> <?php genesis_before_content(); ?></p>
<div id="content">
<p> <?php genesis_before_loop(); ?></p>
<div class="post hentry">
<h1 class="entry-title"><?php _e("Site Archives", 'genesis'); ?></h1>
<div class="entry-content">
<p> <?php $categories = get_categories( $args );?> </p>
<ul class="catArchive">
<?php foreach ($categories as $category) { $catCounter++; $catLink=get_category_link($category->term_id);<br />
$catStyle = '';<br />
if (is_int($catCounter / 2)) $catStyle = ' class="catAlt"';</p>
<p> echo '<li'.$catStyle.'>
<h3><a href="'.$catLink.'" title="'.$category->name.'">'.$category->name.'</a></h3>
<p>';<br />
echo '
<ul>';</p>
<p> query_posts('cat='.$category->term_id.'&showposts=5');?></p>
<p> <?php while (have_posts()) : the_post(); ?></p>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<p> <?php endwhile; ?></p>
<li><a href="<?php echo $catLink; ?>" title="<?php echo $category->name; ?>">More <strong><?php echo $category->name; ?></strong></a></li>
</ul>
</li>
<p> <?php } ?>
</ul>
</div>
<p><!-- end .entry-content --></p>
</div>
<p><!-- end .post --><br />
<?php genesis_after_loop(); ?></p>
</div>
<p><!-- end #content --><br />
<?php genesis_after_content(); ?></p>
</div>
<p><!-- end #content-sidebar-wrap --><br />
<?php genesis_after_content_sidebar_wrap(); ?></p>
<p><?php get_footer(); ?><br />
[/php]
To add this to your child theme, simply follow these directions.
1. Open a blank text file.
2. Copy this code into it.
3. Save as page_catarchive.php (or just download: [download id="2"])
4. FTP into your child theme folder.
To use in your theme, create a new page and select Category Archive under Page Template.
Click Publish. Style via your CSS.