• Hey All,

    As the title says… It worked fine in 1.5.1.1, however after upgrading, I’m getting that pesky blank page error.

    I got this plugin from Ian, however, I think he may have missed my previous post about this in another part of the forum.

    Here’s the code:

    <?php
    /*
    Plugin Name: Custom Posts Per Page
    Version: 1.0
    Plugin URI: https://www.ads-software.com/support/6/11211
    Description: Change the number of posts per page displayed for different page types.
    Author: Based on code by rboren & brehaut
    Author URI:
    */
    $posts_per[‘home’] = 5;
    $posts_per[‘day’] = 10;
    $posts_per[‘month’] = 31;
    $posts_per[‘search’] = 10;
    $posts_per[‘year’] = 999;
    $posts_per[‘author’] = 999;
    $posts_per[‘category’] = 999;
    function custom_posts_per_page($query_string) {
    global $posts_per;
    $query = new WP_Query();
    $query->parse_query($query_string);
    if ($query->is_home) {
    if (preg_match(“/posts_per_page=/”, $query_string)) {
    $query_string = preg_replace(“/posts_per_page=[0-9]*/”
    ,”posts_per_page=$num_posts_on_home”
    ,$query_string);
    } else {
    if ($query_string != ”) {
    $query_string .= ‘&’;
    }
    $query_string .= “posts_per_page=$num_posts_on_home”;
    }
    }
    } elseif ($query->is_day) {
    $num = $posts_per[‘day’].’&order=ASC’;
    } elseif ($query->is_month) {
    $num = $posts_per[‘month’].’&order=ASC’;
    } elseif ($query->is_year) {
    $num = $posts_per[‘year’].’&order=ASC’;
    } elseif ($query->is_author) {
    $num = $posts_per[‘author’];
    } elseif ($query->is_category) {
    $num = $posts_per[‘category’];
    } elseif ($query->is_search) {
    $num = $posts_per[‘search’];
    }
    if (isset($num)) {
    if (preg_match(“/posts_per_page=/”, $query_string)) {
    $query_string = preg_replace(“/posts_per_page=[0-9]*/”, “posts_per_page=$num”, $query_string);
    } else {
    if ($query_string != ”) {
    $query_string .= ‘&’;
    }
    $query_string .= “posts_per_page=$num”;
    }
    }
    return $query_string;
    }
    add_filter(‘query_string’, ‘custom_posts_per_page’);
    ?>

    Thanks,

    Justin

Viewing 4 replies - 1 through 4 (of 4 total)
  • I used this plugin with no problems in 1.5.1.2 (and 1.5.1.3). Perhaps Matt Read’s Custom Query Strings plugin will work better for you:

    https://mattread.com/archives/2005/03/custom-query-string-plugin/

    Thread Starter functionjunkie

    (@functionjunkie)

    Thanks Kafka, that works like a charm.

    Cheers,

    – Justin

    is there anyone who can post the contents of matt’s plugin? the download link has been dead for almost a week. it’s kinda confusing, given how otherwise common-sense and awesome wordpress is, that basic archiving functionality a content management system should have is available only via an unreliable third-party plug-in.

    never mind, just found the other alternative, perpage.phps (which i’d initially shied away from, hearing how people were having administrative interface issues after installing it, but apparently that issue doesn’t affect my wordpress version). i installed it, and it’s working beautifully.

    i’m grateful for the perpage.phps. but, after moving from movable type in the winter, i’ve been totally raving to clients and people i know about how awesome wordpress is, and this basic functionality issue, archives not behaving as archives would be expected to in a user-friendly context, came as my first wordpress dissapointment. though in all else, wordpress still rocks totally. thank the gods for plug-in and php script developers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Posts Per Page Plugin Spitting Back Blank Page After Upgrade to 1.5.1.2’ is closed to new replies.