Function Reference: geodir_buddypress_pagination

Summary

BuddyPress listings tab pagination.

Package

GeoDirectory_BuddyPress_Integration

Parameters

$before
(string) (required) Pagination before HTML.

Default: None
$after
(string) (required) Pagination after HTML.

Default: None
$prelabel
(string) (required) Pagination previous label text.

Default: None
$nxtlabel
(string) (required) Pagination next label text.

Default: None
$pages_to_show
(int) (required) Number of pages to show.

Default: None
$always_show
(bool) (required) Always display the pagination? Default: false.

Default: None

Change Log

Since: 1.0.0

Source File

geodir_buddypress_pagination() is located in geodir_buddypress/includes/gdbuddypress_template_functions.php [Line: 452]

Source Code

function geodir_buddypress_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false)
{
    global $posts_per_page, $found_posts, $paged;
    if (empty ($prelabel)) {
        $prelabel = '«';
    }
    global $bp;
    $user_domain = geodir_buddypress_get_user_domain();

    if (empty($nxtlabel)) {
        $nxtlabel = '»';
    }

    $half_pages_to_show = round($pages_to_show / 2);

    if (!is_single() && $found_posts > 0 && $posts_per_page > 0) {
        $numposts = $found_posts;
        $max_page = ceil($numposts / $posts_per_page);

        if (empty($paged)) {
            $paged = 1;
        }

        $current_domain = '';
        if ($bp->current_component && $bp->current_action) {
            $component_domain = trailingslashit($user_domain . $bp->current_component . '/');
            $current_domain = trailingslashit($user_domain . $bp->current_component . '/' . $bp->current_action);
        }

        if ($max_page > 1 || $always_show) {
            echo "$before  $after";
        }
    }
}