Forums

Get category and date archives to display all posts? (11 posts)

  1. flyingrabbit
    Member
    Posted 4 years ago #

    I'm having a devil of a time overriding the defualt setting - I'm sure there's a way of doing this, but the Wiki hasn't been helpful at all, and my searches here have been fruitless as well.

  2. flyingrabbit
    Member
    Posted 4 years ago #

    Maybe this is difficult?

  3. sadish
    Member
    Posted 4 years ago #

    try this just b4 calling 'the loop'

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

    this will give u all posts for one particular month, when a monthly archive is viewed.

    I think u may extend it for categories.

    Thanks.

  4. asianmack
    Member
    Posted 4 years ago #

    sadish, this does work for Categories as well! Thanks

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

  5. ryan
    WordPress Dev
    Posted 4 years ago #

    Or, in your root index.php (not the one in your theme directory), add this before including the blog header.

    $posts_per_archive_page = -1;

    -1 means nopaging.

  6. ceo
    Member
    Posted 4 years ago #

    Oh, wow! Thanks so much, I've been trying to figure out how to do this for months now!

  7. joakimlea
    Member
    Posted 4 years ago #

    thanks ryan for that releaving piece of code!

  8. alexholm
    Member
    Posted 3 years ago #

    Though, that $posts_per_archive_page method didn't work for me with WP2.0, so I had to squeeze my noodle abit. I ended up with putting this in my-hacks.php file:

    if ( !function_exists('fulu_sc_fix') ) :
    function fulu_sc_fix($obj) {
    if(is_search() || is_archive()) {
    $obj->query_vars['posts_per_page'] = 12;
    }
    }
    endif;
    add_action('pre_get_posts', 'fulu_sc_fix');

    What the code do is setting the posts_per_page variable to a value of my choice when the page is_search or is_archive.

  9. alphaoide
    Member
    Posted 3 years ago #

    The following is probably a more robust plugin.
    http://mattread.com/projects/wp-plugins/custom-query-string-plugin/

  10. alexholm
    Member
    Posted 3 years ago #

    Ah ha! What a handy plugin, thanks, no need for my hack then ;-)

  11. cclark
    Member
    Posted 3 years ago #

    That plugin is a Godsend!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags