• Resolved ericbowers

    (@ericbowers)


    I am having difficulty getting my archives on my photoblog to display properly. For the Month Archives, I would like it to display all posts in a month. For the category archives, I would like it to display all posts in the category at once. However for both it will only display the ten most recent posts. How can I get the archives to display all posts for a category and month?

    The archives in question are to be found here…
    https://www.madnessmatrix.com/archives

    Here is the code in my archive.php template file:

    <?php get_header(); ?>
    
    <!-- BEGIN main -->
    <div id="main"><div id="main-inner">
    
    <?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="page-title">Archive for the '<?php echo single_cat_title(); ?>' category</h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="page-title">Archive for the month '<?php the_time('F, Y'); ?>'</h2>
    
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="page-title">Author Archive</h2>
    
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    <h2 class="page-title">Blog Archives</h2>
    
    <?php } ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <!-- BEGIN post -->
    <div id="post-<?php the_ID(); ?>" class="post clearfix">
    <div class="post-body">
    <a href="<?php the_permalink(); ?>" title="Permanent Link to '<?php the_title(); ?>'"><?php the_excerpt(); ?></a>
    </div>
    <h3 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to '<?php the_title(); ?>'"><?php the_title(); ?></a></h3>
    <h4 class="post-meta"><?php the_time('F jS, Y') ?></h4>
    </div>
    <!-- END post -->
    <?php endwhile; ?>
    
    <?php else : ?>
    
    <h3>Not Found</h3>
    
    <?php endif; ?>
    
    </div></div>
    <!-- END #main -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    And here is the code for my page-archives.php file:

    <?php
    /*
    Template Name: Archives Template
    */
    ?>
    
    <?php get_header(); ?>
    
    <!-- BEGIN main -->
    <div id="main"><div id="main-inner">
    
    <h2 class="page-title">Archives</h2>
    
    <h3 class="post-title">Recent photos</h3>
    <?php
    $posts = get_posts('numberposts=30');
    foreach($posts as $post) :
    setup_postdata($post);
    ?>
    <!-- BEGIN post -->
    <div id="post-<?php the_ID(); ?>" class="post clearfix">
    <div class="post-body">
    <a href="<?php the_permalink(); ?>" title=""><?php the_excerpt(); ?></a>
    </div>
    <h3 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to '<?php the_title(); ?>'"><?php the_title(); ?></a></h3>
    <h4 class="post-meta"><?php the_time('F jS, Y') ?></h4>
    </div>
    <!-- END post -->
    <?php endforeach; ?>
    
    </div></div>
    <!-- END #main -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Help is appreciated. Thank you.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Archive problem – getting archive to display all posts’ is closed to new replies.