/** * Get the end number for the current docs view (ie "Viewing 5 - *8* of 12") * * Here's the math: Multiply the posts_per_page by the current page number. If it's the last page * (ie if the result is greater than the total number of docs), just use the total doc count * * @package BuddyPress Docs * @since 1.0-beta-2 * * @return int $end The start number */ function bp_docs_get_current_docs_end() { global $bp; $paged = !empty($bp->bp_docs->doc_query->query_vars['paged']) ? $bp->bp_docs->doc_query->query_vars['paged'] : 1; $posts_per_page = !empty($bp->bp_docs->doc_query->query_vars['posts_per_page']) ? $bp->bp_docs->doc_query->query_vars['posts_per_page'] : 10; $end = $paged * $posts_per_page; if ($end > bp_docs_get_total_docs_num()) { $end = bp_docs_get_total_docs_num(); } return apply_filters('bp_docs_get_current_docs_end', $end); }
<?php do_action('bp_docs_loop_additional_td'); ?> </tr> <?php } ?> </tbody> </table> <div id="bp-docs-pagination"> <div id="bp-docs-pagination-count"> <?php printf(__('Viewing %1$s-%2$s of %3$s docs', 'bp-docs'), bp_docs_get_current_docs_start(), bp_docs_get_current_docs_end(), bp_docs_get_total_docs_num()); ?> </div> <div id="bp-docs-paginate-links"> <?php bp_docs_paginate_links(); ?> </div> </div> <?php } else { ?> <?php