The MU forums have moved to WordPress.org

How to change default posts_per_page for all blogs (8 posts)

  1. conpeo
    Member
    Posted 13 years ago #

    How to change posts_per_page to 5 instead of 10.
    default posts_per_page is 10 in backend -options-reading, but I dont want to change option reading blog by blog.

    Edit themes/index.php


    <?php $custom_loopcount = 0; ?>
    <?php if (have_posts()) : while ((have_posts()) && ($custom_loopcount < 5)) : the_post(); ?>
    <?php if (is_home()) $custom_loopcount++; ?>

    how come themes' "Previous Entries" is show up same posts with first index page?

  2. conpeo
    Member
    Posted 13 years ago #

    after code added, how come themes' "Previous Entries" never show up at the bottom?

    dig... look for solution.

  3. drmike
    Member
    Posted 13 years ago #

    Well we can change a setting in your defaults to the new number.

    Open up wp-admin/upgrade-schema.php and change:

    add_option('posts_per_page', 10);

    to:

    add_option('posts_per_page', 5);

    You can try running the Dashboard -> System Admin -> Upgrade and see if that changes it. You may luck out. :)

  4. ladynada
    Member
    Posted 12 years ago #

    is this saying that 10 posts per page is hard coded?

    thanks,
    nada

  5. selad
    Member
    Posted 12 years ago #

    ladynada, it is hard coded as the default for new blogs.
    You can run a script to change it for all current users. I do it when needed.

  6. selad
    Member
    Posted 12 years ago #

    For anyone interested, I have released the script I use to change option for all existing blogs. See it here:
    http://www.ringofblogs.com/2007/09/05/a-script-to-set-global-options-for-all-wpmu-blogs/

  7. lunabyte
    Member
    Posted 12 years ago #

    http://wordpress.org/support/topic/11211?replies=23

    Yes, that thread is a little old, but it works nonetheless.

  8. selad
    Member
    Posted 12 years ago #

    lunabyte, that might do the job. My script is some what more general. Maybe I should post it in a different thread

About this Topic