Does anyone know how to limit the number of initially loaded items in the activity stream? I have a heavy media sharing community which causes a slow page load on the activity stream. I’d like to limit the initially displayed entries to 5-10 from the default value of 20.
The BuddyPress Codex shares some info but does not go into great detail and my PHP skills are still a bit weak.
The parameter I am looking to use is ‘per_page’.
Only one filtering example is shown and I cannot figure out how one would take such an example, use the desired parameter and integrate it with the standard loop.
Thank you for this! This code snippet is definitely heading in the right direction. I works well for custom loops of latest entries as long as you do not need to load more, as on the main activity stream page. This is where I am trying to limit the output.
I’ll need to play with it a bit to get working the way I’d like. When I pass the arguments ( ‘per_page=5&page=1′ ) it returns only 5 items as expected, however, it returns the same 5 items every time I click ‘Load More’. I get the same result even if I remove the ‘page=1′ parameter since that is a default value.
I am working with the latest BP 1.5.4 so I am not sure if there were any significant changes to the activity since. I’ll keep searching and experimenting.
@Darin– A small correction. Do NOT edit the main BuddyPress theme files.
-Make a child theme for BP
-copy the file activity/activity-loop.php and place it in your child theme, in a subdirectory called “activity”.
-Edit THAT file.
I am editing this awesome WP/BP theme (framework) Salutation, which includes customized copies of all BP default templates and folder structure, therefore, I am not touching the BP default theme or any core files.
It is certainly something important to remember, thanks for mentioning it.
I’ve spent a great deal of time figuring things out, which is great and helps my understanding. BuddyPress is a good theme development challenge. I definitely plan to learn PHP properly though, to speed up development time.