I'm trying to create a Category archive that uses thumbnails & custom excerpts instead of just titles. Thanks to SpankMarvin, I'm almost there, but the code I'm using only displays 1 post in any category, and if a post has several categories it will only show up in one. (I think).
You can see an example of this in the Desserts category archive - there should be at least 4 posts there, including the jelly filled doughnuts that only show up in the Yeasted Breads category.
Any ideas how to fix this? I'm not a coder and am way out of my depths here. I'd be grateful for your help.
Here is the code I'm using:
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?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 class="title">'<?php echo single_cat_title(); ?>'</h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="title">Archive for <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="title">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="title">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is a search */ } elseif (is_search()) { ?>
<h2 class="title">Search Results</h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="title">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="title">Blog Archives</h2>
<?php } ?>
<div align="center">
<?php /* If this is a category archive */ if (is_category()) { ?>
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
<?php } ?>
<strong>The category archives are currently under construction.</strong> If you are looking for a recipe please use the <a href="http://www.bakingandbooks.com/all-the-recipes/">Recipe Index</a>. Thanks! :)<br /><br />
</div>
<!-- start summary container -->
<div class="summary-container">
<?php if($thumbnail !=='') { ?>
<div class="post_thumb"><a href="<?php the_permalink() ?>" rel="bookmark" title="Click here to go to <?php the_title(); ?>"><img src="<?php echo get_post_meta($post->ID, "front_page_thumb", true);?>" class="front_page_thumb" alt="image for <?php the_title(); ?>" /></a></div>
<?php } ?>
<div class="post_summary"><strong><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></strong><br /> <?php the_time('F j, Y'); ?>.
<br />
<?php if($custom_summary !=='') {
echo get_post_meta($post->ID, "front_page_excerpt", true);?><br />
<a href="<?php the_permalink() ?>" title="Read the full article"> Read the full article</a>
<?php }
if($custom_summary =='') {
the_content('Read the rest of this entry »');
} ?>
</div>
</div>
<!-- end summary container -->
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>