BuddyPress Activity Pagination Not Working - Displays Letters But No Pagination

38 views Asked by At

I'm experiencing an issue with the pagination of BuddyPress activities on my website. Although the letters are displayed correctly, the pagination count and pagination links are not functioning as expected.

$page = isset( $_GET['acpage'] ) ? intval( $_GET['acpage'] ) : 1;

$contest_args = array(
    'per_page'   => 5,
    'user_id'    => bp_displayed_user_id(),
    'page'       => $page,
    'action'     => 'activity_update',
    'meta_query' => array(
        array(
            'key'     => 'contest_id',
            'compare' => 'NOT EXISTS',
        ),
    ),
);
// Check the per_page value
//echo 'per_page: ' . $contest_args['per_page'] . '<br>';

// Check the page value
//echo 'page: ' . $contest_args['page'] . '<br>';
$activities_template = new BP_Activity_Template($contest_args);
if ( bp_has_activities($contest_args) ) : ?>
    <div id="pag-top" class="pagination w-100 d-flex justify-content-between align-items-center mb-3">
        <div class="pag-count" id="group-dir-count-top">
        <?php echo bp_get_activity_pagination_count( ); ?>

        </div>
        <div class="pagination-links" id="group-dir-pag-top">
            <?php echo bp_get_activity_pagination_links(); ?>          
        </div>
    </div>

    <div class="letters d-flex flex-wrap">
        <?php while ( bp_activities() ) : bp_the_activity(); ?>
        <?php    echo get_contest_entry_lockup(bp_get_activity_id());?>
<?php         endwhile; ?>
    </div>

Here the letters are displayed nicely.. I've confirmed that the per_page parameter is set to 5, and there are more than 20 posts available for the user. But both the pagination count and links are not working.

0

There are 0 answers