Need help with my archive page loop
-
I creating a new theme for my site. I’m having trouble with the loop on my archive page. I want to display the category description if it exists. However, if there is no description, the loop returns no posts (when there are posts). I guess I’m missing something important in my loop. Here’s my code:
<?php if ( have_posts() ) : ?> <h1 class="archive-title"><?php single_cat_title( '', true ); ?></h1> <?php if ( category_description() ) : ?> <h5 class="slug-line"><?php echo category_description(); ?></h5> <hr> <div id="column-single"> <?php while ( have_posts() ) : the_post();?> <div class="item"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?></small> <div class="entry"> <?php the_content(); ?> <p class="postmetadata"><?php _e( 'Posted in' ); ?> <em><?php the_category( ', ' ); ?> on <?php the_time('F jS, Y') ?></em></p> </div> <div class="comments-template"> <?php comments_template();?> </div> </div> <?php endwhile;?> <?php else : ?> <p>Sorry - no posts found</p> <?php endif; ?>
Viewing 14 replies - 1 through 14 (of 14 total)
Viewing 14 replies - 1 through 14 (of 14 total)
- The topic ‘Need help with my archive page loop’ is closed to new replies.