bp_nouveau_pagination( string $position )
Pagination for loops
Description
Parameters
- $position
-
(Required)
Source
File: bp-templates/bp-nouveau/includes/template-tags.php
function bp_nouveau_pagination( $position ) {
$screen = 'dir';
$pagination_type = bp_current_component();
if ( bp_is_user() ) {
$screen = 'user';
} elseif ( bp_is_group() ) {
$screen = 'group';
$pagination_type = bp_current_action();
if ( bp_is_group_admin_page() ) {
$pagination_type = bp_action_variable( 0 );
}
}
if ( 'subgroups' === $pagination_type ) {
$pagination_type = 'groups';
}
switch ( $pagination_type ) {
case 'blogs':
$pag_count = bp_get_blogs_pagination_count();
$pag_links = bp_get_blogs_pagination_links();
$top_hook = 'bp_before_directory_blogs_list';
$bottom_hook = 'bp_after_directory_blogs_list';
$page_arg = $GLOBALS['blogs_template']->pag_arg;
break;
case 'members':
case 'friends':
case 'manage-members':
$pag_count = bp_get_members_pagination_count();
$pag_links = bp_get_members_pagination_links();
// Groups single items are not using these hooks
if ( ! bp_is_group() ) {
$top_hook = 'bp_before_directory_members_list';
$bottom_hook = 'bp_after_directory_members_list';
}
$page_arg = $GLOBALS['members_template']->pag_arg;
break;
case 'groups':
$pag_count = bp_get_groups_pagination_count();
$pag_links = bp_get_groups_pagination_links();
$top_hook = 'bp_before_directory_groups_list';
$bottom_hook = 'bp_after_directory_groups_list';
$page_arg = $GLOBALS['groups_template']->pag_arg;
break;
case 'notifications':
$pag_count = bp_get_notifications_pagination_count();
$pag_links = bp_get_notifications_pagination_links();
$top_hook = '';
$bottom_hook = '';
$page_arg = buddypress()->notifications->query_loop->pag_arg;
break;
case 'membership-requests':
$pag_count = bp_get_group_requests_pagination_count();
$pag_links = bp_get_group_requests_pagination_links();
$top_hook = '';
$bottom_hook = '';
$page_arg = $GLOBALS['requests_template']->pag_arg;
break;
}
$count_class = sprintf( '%1$s-%2$s-count-%3$s', $pagination_type, $screen, $position );
$links_class = sprintf( '%1$s-%2$s-links-%3$s', $pagination_type, $screen, $position );
?>
<?php
if ( 'bottom' === $position && isset( $bottom_hook ) ) {
/**
* Fires after the component directory list.
*
* @since BuddyPress 3.0.0
*/
do_action( $bottom_hook );
};
?>
<div class="<?php echo esc_attr( 'bp-pagination ' . sanitize_html_class( $position ) ); ?>" data-bp-pagination="<?php echo esc_attr( $page_arg ); ?>">
<?php if ( $pag_count ) : ?>
<div class="<?php echo esc_attr( 'pag-count ' . sanitize_html_class( $position ) ); ?>">
<p class="pag-data">
<?php echo esc_html( $pag_count ); ?>
</p>
</div>
<?php endif; ?>
<?php if ( $pag_links ) : ?>
<div class="<?php echo esc_attr( 'bp-pagination-links ' . sanitize_html_class( $position ) ); ?>">
<p class="pag-data">
<?php echo wp_kses_post( $pag_links ); ?>
</p>
</div>
<?php endif; ?>
</div>
<?php
if ( 'top' === $position && isset( $top_hook ) ) {
/**
* Fires before the component directory list.
*
* @since BuddyPress 3.0.0
*/
do_action( $top_hook );
};
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.