Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to only show 5 items per page with pagination working on Activity stream?


  • tjbrewers
    Participant

    @tjbrewers

    How do I show 5 items per page with pagination ( i.e. with Load More actually working) on the Activity stream?

    I’ve tried the filter and direct method of .’&per_page=5′ appended to bp_ajax_querystring, i.e. bp_ajax_querystring( ‘activity’ ).’&per_page=5’…but the Load More button does not load any further items into the stream.

    Any ideas? Thanks a bunch!

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

  • abysshorror
    Member

    @abysshorror

    Try this:

    On functions.php

    add_filter( ‘bp_dtheme_ajax_querystring’, ‘limit_activity_posts’, 15, 2 );
    function limit_activity_posts( $query_string, $object ) {
    if( ‘activity’ == $object ) {
    $query_string = add_query_arg( ‘per_page’, 5, $query_string );
    }
    return $query_string;
    }

    It’s working for me, thanks to the guys of Huddle Theme :)


    tjbrewers
    Participant

    @tjbrewers

    @abysshorror, tried that. Nothing happened.

    I then went directly into plugins/buddypress/bp-activity/bp-activity-template.php line 301 and changed ‘per_page’ default from 20 to 5, just to see what would happen. It shows 5 items in the stream with the Load More button. But when you click on the button, nothing else loads.

    @tjbrewers, try the below methood, thats what am using

    /*Change the number of activity items to show per page */

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


    tjbrewers
    Participant

    @tjbrewers

    @naijaping, That’s actually what I started with. It definitely limits the stream to ‘&per_page’, but then “Load More” button doesn’t reveal any additional items in the stream. It says: Viewing item 1 to 5 (of 37 items); so the content is there.

    Does your “Load More” button work? Does it load more on the same page? Are you pagnation with it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to only show 5 items per page with pagination working on Activity stream?’ is closed to new replies.
Skip to toolbar