I have this code trying to sort by a specific category. I keeps saying it has an unexpected $end on line 39. What did I do wrong in the code. I've been playing with it and reading the codex for a while and can't figure it out.
<?php get_header(); ?>
<div id="container">
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category('5')) { ?>
<h1 class="pagetitle"><?php _e('Archive for the', 'default'); ?> ‘<? php single_cat_title(); ?>’ <?php _e('category', 'default'); ?></h1>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class(archives-page) ?>>
<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small class="meta"><?php the_time(__('F jS, Y','default')); ?> <?php edit_post_link(__( 'Edit', 'default' ), ' | ', ''); ?></small>
<div class="entry">
<?php the_content((__( '» Read more: ', 'default')) . the_title('', '', false)); ?>
</div>
<div class="postmetadata clearfix">
<p class="commentslink alignright">
<?php comments_popup_link( __( 'No comments', 'default' ), __( '1 comment', 'default' ), __( '% comments', 'default' )); ?> »
</p>
<p class="categories">
<?php _e('Posted in ', 'default' ); the_category(', '); ?>
</p>
<?php the_tags( '<p class="tags">Tags: ', ' ', '</p>'); ?>
</div>
</div>
<?php endwhile; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
while( have_posts() )lines, when you should have only one. – t31os Jul 30 '11 at 9:22