• My category pages are only showing one post per category instead of the 8-12 that should be there. I’m using the same archive.php file that I’m using for a site that works, so I’m trying to figure out what other file could be affecting these pages. This site is supposed to go live on Tuesday.

    Thanks,
    gttygrl

Viewing 10 replies - 1 through 10 (of 10 total)
  • Have you tried:

    – deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems?

    Are you running any custom queries that you forget to reset?

    Thread Starter gttygrl

    (@gttygrl)

    Excellent advice! It’s the WP Menu Manager that’s causing it. Unfortunately now I have to figure out how to fix it, although at this point maybe I’ll just hand code the damned thing.

    Thanks for helping me pinpoint the issue!

    Thread Starter gttygrl

    (@gttygrl)

    Hmm, nope, that wasn’t it. There’s something about my left sidebar that’s causing it. Damn.

    Are you using query_posts or get_posts in the sidebar? If so, wp_reset_query might be needed before the main Loop.

    Thread Starter gttygrl

    (@gttygrl)

    Dammit. It’s not the sidebar either. Turns out there was a query_posts(‘showposts=10’); in the default sidebar, so the main content was showing the first ten posts regardless of category.

    I tried the wp_reset_query right before the main content Loop, but still just the one post.

    This is my archive.php:

    <?php include(TEMPLATEPATH . '/templates/head.php'); ?>
    
    	<?php if (have_posts()) : ?>
    	  <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    
    	  <h2 class="archive">
        <?php /* If this is a category archive */ if (is_category()) { ?>
        Posts Categorized "<?php single_cat_title(); ?>"
        <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
        Posts Tagged "<?php single_tag_title(); ?>"
        <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
        Archive for <?php the_time('F jS, Y'); ?>
        <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
        Archive for <?php the_time('F, Y'); ?>
        <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
        Archive for <?php the_time('Y'); ?>
        <?php /* If this is an author archive */ } elseif (is_author()) { ?>
        Author Archive
        <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
        Blog Archives
        <?php } ?>
      	</h2>
    <?php wp_reset_query(); ?>
      	<?php $postnumber = '1' ?>
    
      	<?php while (have_posts()) : the_post(); ?>
      	<div class="post<?php if($postnumber == '1') echo " post" . $postnumber; $postnumber++; ?>" id="post-<?php the_ID(); ?>">
      		<?php include(TEMPLATEPATH . '/templates/titleBlock.php'); ?>
    
    		<!--<?php remove_filter ('the_content',  'wpautop'); ?>
      				<?php the_excerpt('<br /><b>Read the rest of this entry...</b>'); ?>
    		<a href="<?php the_permalink() ?>">Read more...</a>-->
    
    		<?php the_tags( '<p><span>Tags:</span> ', ', ', '</p>'); ?>
    
      		<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
      	</div>
        <?php endwhile; ?>

    (Apologies if that didn’t work, this is my first time using the code tags.)

    Thread Starter gttygrl

    (@gttygrl)

    And this is one of the pages in question:

    https://bit.ly/96T090 (Note: still in progress)

    It might be better if we saw the the relevant sidebar file. Drop a copy of the file into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Thread Starter gttygrl

    (@gttygrl)

    Oo, cool!

    Here’s the link:
    https://wordpress.pastebin.com/Q2WrGicf

    It’s the first time I’ve created a sidebar without just finding a template that already had one, so it would make sense if the problem is there.

    Thread Starter gttygrl

    (@gttygrl)

    Still need help, if anyone has any ideas.

    Try replacing:

    <?php query_posts('showposts=10'); ?>
    <ul>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    </ul>

    with:

    <?php $recent_posts = get_posts('posts_per_page=10'); ?>
    <ul>
    <?php foreach($recent_posts as $post) :
    setup_postdata($post);
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    and see if that helps. If you’re still having problems, the next place to look at is the other couple of template files that are being pulled into that sidebar.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Category page only showing one post’ is closed to new replies.