Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add filters to if ( bp_has_activities( bp_ajax_querystring( activity )) )

  • @revolutionfrance

    Participant

    Hello, I am having the activity loop in several places on my bp installation, and would like to filter them in different ways, so how can I add per_page=5 to “ ? I have tried many different alternatives, but to no avail…

    Anyone that can help?
    Thanks a lot!

Viewing 7 replies - 1 through 7 (of 7 total)
  • @revolutionfrance

    Participant

    Anyone? :-) Sorry for bumping topic, but has been one week and no answer

    @hnla

    Participant

    This very same question was asked in another thread that I responded to yesterday, I’ll look for a link to it.

    Quick search often comes up trumps

    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-limit-activity-items-for-per-page/#post-81113

    @revolutionfrance

    Participant

    Hello @hlna, thanks for the answer, I had done a search before and found that thread, but I still have 2 problems:
    1/ The functions.php hack does not work since I have my activity loop in several places, and in only one of them I need to filter the activity.
    2/ The concatenating solution does not display anything at all…

    Any other ideas?

    @revolutionfrance

    Participant

    Bumpidy bump

    @revolutionfrance

    Participant

    Sorry for bumping again…there has to be someone that knows a way to do this??

    @chefouvi

    Participant

    @revolutionfrance Just wondering if this won’t work! Why don’t you just add the filter function directly into your theme file exactly where u want the filter to apply right before you call the
    `<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' )) ) :?>`
    I mean something like this:
    `
    <?php
    function my_query_filter_new ( $query_string ) {
    $query_string .= ‘&per_page=10’;
    return $query_string;
    }
    add_filter( ‘bp_ajax_querystring’, ‘my_query_filter_new’ );
    if ( bp_has_activities( bp_ajax_querystring( ‘activity’ )) ) :?>
    `
    I haven’t tried this but I don’t see why it wouldn’t work.
    I hope this helps.

    @horroruk

    Participant

    I got this to work using the last bit of code shown above, however, it needs to be added without the smiley:

    `<?php
    function my_query_filter_new ( $query_string ) {
    $query_string .= ‘&per_page=5’;
    return $query_string;
    }
    add_filter( ‘bp_ajax_querystring’, ‘my_query_filter_new’ );
    if ( bp_has_activities( bp_ajax_querystring( ‘activity’ )) ) ; ?>`

    The problem I have, is that once this has been added, the ‘Load More’ link at the bottom doesn’t do anything.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add filters to if ( bp_has_activities( bp_ajax_querystring( activity )) )’ is closed to new replies.
Skip to toolbar