Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change the number of activity items to show per page?


  • Liesl Fawcett
    Participant

    @liesl1698

    I just want to know if there’s a way to change the number of posts shown in the activity stream. Thanks in advance!

Viewing 18 replies - 1 through 18 (of 18 total)

  • Liesl Fawcett
    Participant

    @liesl1698

    Thanks, I’ve seen that but I’m not a developer so I don’t know how to do it…


    3sixty
    Participant

    @3sixty

    Haven’t tested yet but I think you would find the ‘ while ‘ statement and edit this function like this:

    bp_has_activities(‘per_page=10’);

    if you want ten items per page.

    Let me know how it works for you.


    Liesl Fawcett
    Participant

    @liesl1698

    I had this: <?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) ) ) : ?> and I didn’t know how to add the per_page part so I did it this way: <?php if ( bp_has_activities (‘per_page=35’) ) : ?> and it worked. Thank you very much!


    Liesl Fawcett
    Participant

    @liesl1698

    Ok so because I removed that my “Load More” thing isn’t working anymore… Is there a way to put (‘per_page=35’) along with ( bp_ajax_querystring( ‘activity’ ) )??

    I had this: <?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) ) ) : ?>

    and to specify the number of posts to show on the activity stream I want to add this: (‘per_page=35’)

    without having to completely remove the ( bp_ajax_querystring( ‘activity’ ) ) part.


    celsosoares
    Participant

    @celsosoares

    Tried this but this the ajax function doesn’t load any more activity :(

    <?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) . ‘per_page=6’ ) ) : ?>


    muchad
    Participant

    @muchad

    put this in your functions.php in your theme

    function my_custom_query_filter( $query_string ) {
    $query_string .= ‘&per_page=10?;
    return $query_string;
    }
    add_filter( ‘bp_dtheme_ajax_querystring’, ‘my_custom_query_filter’ );

    you just change per_page option as you need…
    it’s run for me, you can see here http://blog.uin-malang.ac.id


    aomao
    Participant

    @aomao

    @muchad
    Thanks that worked


    streamstalker
    Member

    @streamstalker

    Here is one of the easiest ways to change the amount of activity stream posts per page in the default BuddyPress theme.

    1. FTP to – example.com/wp-content/plugins/buddypress/bp-activity/ – in your WP directory
    2. Open – bp-activity-templatetags.php – in your text editor
    3. Ctrl + F – then enter – ‘per_page’
    4. Just change the value following – ‘per_page’ =>


    muchad
    Participant

    @muchad

    @aomao
    your welcome, please visit my buddypress at http://blog.uin-malang.ac.id


    muchad
    Participant

    @muchad

    @streamstalker
    good job..


    Aliceembroid
    Participant

    @aliceembroid

    I would also like to change the number of items showing on activity stream I tried both of the suggestion here and they both broke my site showing an error page. I think the problem with the suggestion from muchad is that I didn’t know quite where to add the code. can someone help me.
    Alice


    @mikey3d
    Participant

    @mikey3d

    I just try it above muchad’s code and put that in your child theme function.php. It works, why? Because the characters are messing it up. Here’s workable code:
    `//=Change the number of activity items to show per page
    function my_custom_query_filter( $query_string ) {
    $query_string .= ‘&per_page=30’;
    return $query_string;
    }
    add_filter( ‘bp_dtheme_ajax_querystring’, ‘my_custom_query_filter’ );`


    sladkoe6ka
    Participant

    @sladkoe6ka

    guys it is very easy!
    Go to buddypress/bp-activity/bp-activity-templatetags.php
    change the number in the line 172
    ‘per_page’ => 20, // number of items per page

    @sladkoe6ka thanks so much. simplest solution ever, worked like a charm

    regard


    stwc
    Participant

    @stwc

    Terrible advice in this thread from people recommending edits to core bp files — any changes to them will be lost next time you upgrade Buddypress. Never edit core. Use the custom query filter instead.

    @Mikey3D just tried your code and it even conrol members page. whatever number you set is for both activities and members page.

    thanks


    cwulff
    Participant

    @cwulff

    How would I write a query filter so that the activity stream that I copied to the home page shows five items, while the main one shows the default twenty?

Viewing 18 replies - 1 through 18 (of 18 total)
  • The topic ‘How to change the number of activity items to show per page?’ is closed to new replies.
Skip to toolbar