0

I am trying to create a letter archive for the users on their buddypress profile page. The letters are displayed in the profile page tab, but the pagination is not working.

$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',
        ),
    ),
);

$activities_template = new BP_Activity_Template($contest_args);

I use bp_activity_pagination_count() for pagination count and bp_pagination_links for pagination links. But the pagination count and pagination links are not working.

Here is the code:

<h2 class="text-center mt-3 mb-5"><?php echo bp_core_get_username(bp_displayed_user_id()); ?>'s Letters</h2>

<?php 
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>

    <div id="pag-bottom" class="pagination w-100 d-flex justify-content-between align-items-center mb-5">
        <div class="pag-count" id="group-dir-count-bottom">
            <?php echo bp_get_activity_pagination_count(); ?>
        </div>
        <div class="pagination-links" id="group-dir-pag-bottom">
            <?php echo bp_get_activity_pagination_links(); ?>
        </div>
    </div>

<?php else : ?>
    <div>
        <h2><?php echo bp_core_get_username(bp_displayed_user_id()); ?> hasn't written a letter yet.</h2>
    </div>
<?php endif;
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.