conpeo
Member
Posted 16 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?
conpeo
Member
Posted 16 years ago #
after code added, how come themes' "Previous Entries" never show up at the bottom?
dig... look for solution.
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. :)
is this saying that 10 posts per page is hard coded?
thanks,
nada
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.
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/
lunabyte
Member
Posted 16 years ago #
http://wordpress.org/support/topic/11211?replies=23
Yes, that thread is a little old, but it works nonetheless.
lunabyte, that might do the job. My script is some what more general. Maybe I should post it in a different thread