Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rachelbaker/1845414 to your computer and use it in GitHub Desktop.
Save rachelbaker/1845414 to your computer and use it in GitHub Desktop.
WordPress Genesis Theme Custom Archive Listing Template - All Posts by Category
<?php
/**
* Template Name: Custom Category Archive
*
*
*/
get_header(); ?>
<?php genesis_before_content_sidebar_wrap(); ?>
<div id="content-sidebar-wrap">
<?php genesis_before_content(); ?>
<div id="content">
<?php genesis_before_loop(); ?>
<div class="post hentry">
<h1 class="entry-title"><?php _e("Archive", 'genesis'); ?></h1>
<div class="entry-content">
<?php $categories = get_categories( $args );?>
<?php foreach ($categories as $category) { $catCounter++; $catLink=get_category_link($category->term_id);
$catStyle = '';
if (is_int($catCounter / 2)) $catStyle = ' class="catAlt"';
echo '<h3 class="archive-category"><a href="'.$catLink.'" title="'.$category->name.'">'.ucwords($category->name).'</a></h3>';
query_posts('cat='.$category->term_id.'&posts_per_page=-1');?>
<ul class="archive-post-list">
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php } ?>
</div>
<!-- end .entry-content -->
</div>
<!-- end .post -->
<?php genesis_after_loop(); ?>
</div>
<!-- end #content -->
<?php genesis_after_content(); ?>
</div>
<!-- end #content-sidebar-wrap -->
<?php genesis_after_content_sidebar_wrap(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment