Support » Fixing WordPress » How to ignore “Show Most Recent” for archive pages

  • I’ve recently started working with WordPress 1.5, and I’m having trouble figuring out how to get my template design working.

    I’d like for my archive pages not to be paginated. By that I mean, if I request the archive file for April 2004, I’d like that page to display ALL the posts in April 2004, ignore the “Show Most Recent n Days/Posts” setting. I want that setting to be respected only by the front page. All other pages (yearly/monthly/daily archives) should ignore it.

    The correct way to achieve this is not readily apparent

Viewing 5 replies - 1 through 5 (of 5 total)
  • I faced the same problem sometime before. Havent really found a solution to that.

    any one out there to help ?

    I could easily hack wordpress to do it, but I was looking for an officially blessed method, so that I wouldn’t have to patch my installation every time I upgrade.

    This has to be a pretty common request as it is a “feature” that is readily available in nearly all of the other blog software, particularly MovableType, the most logical direct competitor to WordPress.

    I found what appears to be a solution, at least for me.

    I’m using mod_rewrite rules generated by WordPress to enable clean URLs. So, what I did, was for the pages that I didn’t want paging, I just modified the rules to include a ‘nopaging’ query parameter. For example:

    If second part of the rewrite rule looked like this (this is a monthly archive):


    I fixed it to look like this:


    I added “nopaging=1&” to the beginning of the query string.

    There are a couple of downsides to this approach. The main one is that if you change your permalink paths, and your .htaccess file is writable, WordPress will likely clobber your changes so make sure to ‘chmod og-w’ your .htaccess file.

    I don’t how to do this from inside a template. Maybe I’ll work on that next.


    I don’t know if this is the “officially blessed” approach, but it seems to work.

    NOTE: I did this using WordPress 1.5 beta1 (05-Jan-26 nightly build). I have NO idea what this code will do to a 1.2 installation and I have no idea how to solve this problem in a 1.2 installation.

    Immediately below the

    <?php get_header(); ?>

    call, add the following code:

    <?php $posts = query_posts($query_string . '&nopaging=1'); ?>

    That did it for me. And it SHOULD work for any page where you want to turn off paging, but I can’t guarantee that. If someone more knowledgeable would like to speak up, then please do so.

    you can add this line inside date.php in WordPress theme folder.

    <?php if (is_month()) { $posts = query_posts($query_string . ‘&nopaging=1’); } ?> just before ‘the loop’

    This will make sure it happens only for the monthly archive…and not for the yearly archive.

    I also had to enable paging, if the user is browsing the yearly archive..
    I did add this, just before the end of ‘the loop’

    <?php if (is_month()) {} else { ?><p align="center"><?php posts_nav_link() ?> <?php }; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to ignore “Show Most Recent” for archive pages’ is closed to new replies.