/** * Display navigation to next/previous set of posts when applicable. * * @since Farmtoyou 1.0 * * @global WP_Query $wp_query WordPress Query object. * @global WP_Rewrite $wp_rewrite WordPress Rewrite object. */ function farmtoyou_paging_nav() { global $wp_query, $wp_rewrite; // Don't print empty markup if there's only one page. if ($wp_query->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'farmtoyou'), 'next_text' => __('Next →', 'farmtoyou'))); if ($links) { ?> <nav class="navigation paging-navigation" role="navigation"> <div class="pagination loop-pagination"> <?php echo $links; ?> </div><!-- .pagination --> </nav><!-- .navigation --> <?php } }
function my_pagenavi($recent) { global $wp_query; /* $i = 0; foreach($wp_query->posts as $post){ $cat = get_the_category( $post->ID ); if($cat[0]->name == 'Блог'){ $i++; } }*/ $big = 999999999; // уникальное число для замены $args = array('base' => '?page=%_%', 'format' => '%#%', 'total' => $recent->max_num_pages, 'show_all' => TRUE, 'current' => isset($_GET['page']) ? $_GET['page'] : 1, 'end_size' => 1, 'mid_size' => 2, 'prev_next' => true, 'prev_text' => '<img src="' . TM_URL . '/img/LEFT-ARROW.png" alt="">', 'next_text' => '<img src="' . TM_URL . '/img/RIGHT-ARROW.png" alt="">', 'type' => 'array', 'add_fragment' => '', 'add_args' => False, 'before_page_number' => '', 'after_page_number' => ''); $result = paginate_links($args); if (is_array($result)) { // $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); echo '<ul class="pagination">'; foreach ($result as $page) { echo '<li>' . $page . '</li>'; } echo '</ul>'; } // удаляем добавку к пагинации для первой страницы //$result = str_replace( '/page/1/', '', $result ); }
function do_paging() { if ($this->total_users_for_query > $this->users_per_page) { // have to page the results $this->paging_text = paginate_links(array('total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'prev_text' => '« Previous Page', 'next_text' => 'Next Page »', 'base' => 'users.php?%_%', 'format' => 'userspage=%#%', 'add_args' => array('usersearch' => urlencode($this->search_term)))); } }
/** * Display navigation to next/previous set of posts when applicable. * * @return void */ function my_simone_paging_nav() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 2, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'my-simone'), 'next_text' => __('Next →', 'my-simone'), 'type' => 'list')); if ($links) { ?> <nav class="navigation paging-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Posts navigation', 'my-simone'); ?> </h1> <?php echo $links; ?> </nav><!-- .navigation --> <?php } }
function get_pager_links($page_url = '', $args = array()) { global $wpdb; // page url if ($page_url) { $this->page_url = $page_url; } // total $this->row_count = $wpdb->get_var("SELECT FOUND_ROWS() AS row_count"); // page count $this->page_count = ceil($this->row_count / $this->page_limit); // text $paging_text = ''; // when greater if ($this->row_count > $this->page_limit) { // have to page the results // text $paging_text = paginate_links(array('total' => $this->page_count, 'current' => $this->page_current, 'base' => $this->page_url . (!preg_match('/\\?/', $this->page_url) ? '?' : '&') . '%_%', 'format' => $this->page_no . '=%#%', 'add_args' => $args)); // format if ($paging_text) { $paging_text = sprintf('<span class="displaying-num">' . __('Displaying %d-%d of %d records ', 'mgm') . '</span> %s', number_format_i18n(($this->page_current - 1) * $this->page_limit + 1), number_format_i18n(min($this->page_current * $this->page_limit, $this->row_count)), number_format_i18n($this->row_count), $paging_text); } } // return return str_replace('page-numbers', '', $paging_text); }
function falcon_pagination() { global $wp_query; $big = 999999999; // need an unlikely integer return '<div class="falcon-pagination-wrapper">' . paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages)) . '</div>'; }
function do_paging() { if ($this->total_users_for_query > $this->users_per_page) { // have to page the results $args = array(); if (!empty($this->search_term)) { $args['s'] = urlencode($this->search_term); } if (!empty($this->role)) { $args['role'] = urlencode($this->role); } if (!empty($this->sub_id)) { $args['sub_op'] = urlencode($this->sub_id); $args['doactionsub'] = 'Filter'; } if (!empty($this->level_id)) { $args['level_op'] = urlencode($this->level_id); $args['doactionlevel'] = 'Filter'; } $this->paging_text = paginate_links(array('total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'base' => 'admin.php?page=membershipmembers&%_%', 'format' => 'userspage=%#%', 'add_args' => $args)); if ($this->paging_text) { $this->paging_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s', 'membership') . '</span>%s', number_format_i18n(($this->page - 1) * $this->users_per_page + 1), number_format_i18n(min($this->page * $this->users_per_page, $this->total_users_for_query)), number_format_i18n($this->total_users_for_query), $this->paging_text); } } }
function flat_paging_nav() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 4, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-chevron-left"></i>', 'flat'), 'next_text' => __('<i class="fa fa-chevron-right"></i>', 'flat'))); $allowed_html = array('a' => array('href' => array(), 'class' => array()), 'span' => array('class' => array()), 'i' => array('class' => array())); if ($links) { ?> <nav class="navigation paging-navigation" role="navigation"> <div class="nav-links"> <?php echo wp_kses($links, $allowed_html); ?> </div> </nav> <?php } }
function nexus_pagination() { $prev_arrow = is_rtl() ? '«' : '«'; $next_arrow = is_rtl() ? '»' : '»'; global $wp_query; $total = $wp_query->max_num_pages; $big = 999999999; // need an unlikely integer if ($total > 1) { if (!($current_page = get_query_var('paged'))) { $current_page = 1; } if (get_option('permalink_structure')) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } $pages = paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => $format, 'current' => max(1, get_query_var('paged')), 'total' => $total, 'mid_size' => 4, 'end_size' => 4, 'type' => 'array', 'prev_text' => $prev_arrow, 'next_text' => $next_arrow)); if (is_array($pages)) { $paged = get_query_var('paged') == 0 ? 1 : get_query_var('paged'); echo '<div class="preview"><div class="cont text-center"><div class="pagination"><ul class="pagination">'; foreach ($pages as $page) { echo "<li>{$page}</li>"; } echo '</ul></div></div><div class="clear"> </div></div> '; } } }
/** * Since we don't always have access to the params passed to BP_Groups_Template * we have to wait until after constructor has run to fill in details */ function synchronize() { global $bp; if (isset($this->params) && array_key_exists('parent_id', $this->params)) { /** * Fill in requests by parent_id for tree traversal on admin side */ $this->groups = bp_group_hierarchy_get_by_hierarchy($this->params); $this->total_group_count = $this->groups['total']; $this->groups = $this->groups['groups']; $this->group_count = count($this->groups); // Re-build pagination links with new group counts if ((int) $this->total_group_count && (int) $this->pag_num) { $this->pag_links = paginate_links(array('base' => add_query_arg(array('grpage' => '%#%', 'num' => $this->pag_num, 'sortby' => $this->sort_by, 'order' => $this->order)), 'format' => '', 'total' => ceil((int) $this->total_group_count / (int) $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '←', 'next_text' => '→', 'mid_size' => 1)); } } else { if ($this->single_group && $bp->groups->current_group) { /** * Groups with multi-level slugs are missed by the parent. * Fill them in from $bp->groups->current_group */ $this->groups = array((object) array('group_id' => $bp->groups->current_group->id)); $this->group_count = 1; } } }
/** * Momtaz loop pagination function for paginating loops with multiple posts. This should be used on archive, blog, and * search pages. It is not for singular views. * * @since 0.1 * @access public * @uses paginate_links() Creates a string of paginated links based on the arguments given. * @param array $args Arguments to customize how the page links are output. */ function momtaz_loop_pagination($args = '') { global $wp_query; $total = (int) isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1; $current = (int) get_query_var('paged') ? get_query_var('paged') : 1; // Merge the arguments input with the defaults. $args = wp_parse_args($args, array('total' => $total, 'current' => $current, 'prev_next' => true, 'prev_text' => __('« Previous', 'momtaz'), 'next_text' => __('Next »', 'momtaz'), 'show_all' => false, 'end_size' => 1, 'mid_size' => 1, 'type' => 'plain', 'before' => '<nav class="pagination loop-pagination">', 'after' => '</nav>', 'echo' => true)); // Allow developers to overwrite the arguments with a filter. $args = apply_filters('momtaz_loop_pagination_args', $args); // If there's not more than one page, return nothing. if ($args['total'] < 2) { return; } // Don't allow the user to set this to an array. if ('array' === $args['type']) { $args['type'] = 'plain'; } // Get the paginated links. $page_links = apply_filters('momtaz_loop_pagination', paginate_links($args), $args); // Wrap the paginated links with the $before and $after elements. if (!empty($page_links)) { $page_links = $args['before'] . $page_links . $args['after']; } // Return the paginated links for use in themes. if (!$args['echo']) { return $page_links; } echo $page_links; }
function kad_wp_pagenavi() { global $wp_query, $wp_rewrite; $pages = ''; $max = $wp_query->max_num_pages; if (!($current = get_query_var('paged'))) { $current = 1; } $args['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999)); $args['total'] = $max; $args['current'] = $current; $total = 1; $args['mid_size'] = 3; $args['end_size'] = 1; $args['prev_text'] = '«'; $args['next_text'] = '»'; if ($max > 1) { echo '<div class="wp-pagenavi">'; } if ($total == 1 && $max > 1) { echo paginate_links($args); } if ($max > 1) { echo '</div>'; } }
public function render_frontend($widget_args, $content = '', $context = '') { $gravityview_view = GravityView_View::getInstance(); if (!$this->pre_render_frontend()) { return; } $page_size = $gravityview_view->paging['page_size']; $total = $gravityview_view->total_entries; $atts = shortcode_atts(array('show_all' => !empty($this->settings['show_all']['default'])), $widget_args, 'gravityview_widget_page_links'); // displaying info $curr_page = empty($_GET['pagenum']) ? 1 : intval($_GET['pagenum']); $page_link_args = array('base' => add_query_arg('pagenum', '%#%', gv_directory_link()), 'format' => '&pagenum=%#%', 'add_args' => array(), 'prev_text' => '«', 'next_text' => '»', 'type' => 'list', 'end_size' => 1, 'mid_size' => 2, 'total' => empty($page_size) ? 0 : ceil($total / $page_size), 'current' => $curr_page, 'show_all' => !empty($atts['show_all'])); /** * @filter `gravityview_page_links_args` Filter the pagination options * @since 1.1.4 * @param array $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/) */ $page_link_args = apply_filters('gravityview_page_links_args', $page_link_args); $page_links = paginate_links($page_link_args); if (!empty($page_links)) { $class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : ''; $class = gravityview_sanitize_html_class($class); echo '<div class="gv-widget-page-links ' . $class . '">' . $page_links . '</div>'; } else { do_action('gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.'); } }
function wp_smart_pagination() { global $wp_query; echo '<div class="wp-smart-pagination">'; echo '<div class="wpsp-page-nav">'; $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages ) ); ?> </div><!-- /.wpsp-page-nav --> <form class="wpsp-page-nav-form" action="<?php echo $_SERVER['REQUEST_URI'];?>" method="get"> <label for="sortby" class="wpsp-label wpsp-hidden"><?php _e('Go to', 'wp-smart-pagination'); ?></label> <input class="wpsp-input-number" type="text" placeholder="Jump to" size="6" name="paged" /> <input class="wpsp-button" value="Go" type="submit" > </form> </div><!-- /.wp-smart-pagination --> <?php }
/** * Pagination * * Echoes the pagination for the theme. * * @return string * @access private * @since 1.0 */ function digitalstore_pagination($range = 4, $return = false, $_wp_query = null) { global $paged, $wp_query, $wp_rewrite; $wpq = $_wp_query ? $_wp_query : $wp_query; $max_page = $wpq->max_num_pages; $paged = $paged ? $paged : 1; $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : ($current = 1); $out = '<p class="digitalstore-pagination">'; $pages_text = sprintf(__('Page %d of %d', 'edd-digitalstore'), number_format_i18n($paged), number_format_i18n($max_page)); $out .= '<span class="pages">' . $pages_text . '</span>'; $pagination = array('base' => esc_url(add_query_arg('paged', '%#%')), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'end_size' => $range, 'prev_text' => __('«', 'edd-digitalstore'), 'next_text' => __('»', 'edd-digitalstore'), 'type' => 'plain'); if ($wp_rewrite->using_permalinks()) { $base_url = get_pagenum_link(1); if (is_search()) { $base_url = preg_replace('/\\?.*/', '', $base_url); } $pagination['base'] = user_trailingslashit(trailingslashit(esc_url(remove_query_arg(array('s'), $base_url))) . 'page/%#%/', 'paged'); } if (!empty($wp_query->query_vars['s'])) { $pagination['add_args'] = array('s' => get_query_var('s')); } $out .= paginate_links($pagination); $out .= '</p>'; if ($return) { return $out; } else { echo $out; } }
function gazeta_the_posts_pagination($query, $echo = true) { $pagination = ''; global $wp_query; if (empty($query)) { $query = $wp_query; } if ($query->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%'; $args = array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'type' => 'list', 'add_args' => array_map('urlencode', $query_args), 'prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>', 'before_page_number' => '<span>', 'after_page_number' => '</span>'); // Set up paginated links. $pagination = paginate_links(apply_filters('gazeta_old_navigation_args', $args)); if ($pagination) { if ($echo === false) { return '<nav class="navigation pagination"><div class="nav-links">' . $pagination . '</div></nav>'; } else { echo '<nav class="navigation pagination"><div class="nav-links">'; echo $pagination; echo '</div></nav>'; } } }
function pagination($pages = '', $range = 4) { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-angle-left"></i>', 'crunchpress'), 'next_text' => __('<i class="fa fa-angle-right"></i>', 'crunchpress'))); if ($links) { ?> <div class="pagination-all pagination" role="navigation"> <ul id='pagination'> <li> <?php echo $links; ?> </li> </ul><!-- .pagination --> </div><!-- .navigation --> <?php } }
function custom_pagination($numpages = '', $pagerange = '', $paged = '') { if (empty($pagerange)) { $pagerange = 2; } global $paged; if (empty($paged)) { $paged = 1; } if ($numpages == '') { global $wp_query; $numpages = $wp_query->max_num_pages; if (!$numpages) { $numpages = 1; } } $uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2); $split_parameters = explode('&', $uri_parts[1]); for ($i = 0; $i < count($split_parameters); $i++) { $final_split = explode('=', $split_parameters[$i]); $split_complete[$final_split[0]] = $final_split[1]; } $pagination_args = array('base' => preg_replace('/\\?.*/', '', get_pagenum_link(1)) . '%_%', 'format' => 'page/%#%', 'total' => $numpages, 'current' => $paged, 'show_all' => False, 'end_size' => 1, 'mid_size' => $pagerange, 'prev_next' => True, 'prev_text' => __('«'), 'next_text' => __('»'), 'type' => 'plain', 'add_args' => $split_complete, 'add_fragment' => ''); $paginate_links = paginate_links($pagination_args); if ($paginate_links) { echo "<div class='pagination_bar_container'>"; echo "<div class='pagination_bar clearfix'>"; echo $paginate_links; echo "</div>"; echo "</div>"; } }
function ml_pagination() { ?> <?php $prev_arrow = is_rtl() ? ' <span class = "icon more_icon">' : '<span class = "icon previous_icon">'; $next_arrow = is_rtl() ? ' <span class = "icon more_icon">' : '<span class = "icon more_icon">'; global $wp_query; $total = $wp_query->max_num_pages; $big = 999999999; // need an unlikely integer if ($total > 1) { ?> <h6>Browse the Archives:</h6> <?php if (!($current_page = get_query_var('paged'))) { $current_page = 1; } if (get_option('permalink_structure')) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => $format, 'current' => max(1, get_query_var('paged')), 'total' => $total, 'mid_size' => 3, 'type' => 'list', 'prev_text' => $prev_arrow, 'next_text' => $next_arrow)); } }
/** * Функция пагинации * * @param $maxNumPages * @param $current * @param null $url * * @return void */ function paginate_news($maxNumPages, $current, $url = NULL) { if ($maxNumPages < 2) { return; } echo paginate_links(array('base' => $url . '%_%', 'format' => '?page=%#%', 'total' => $maxNumPages, 'current' => intval($current), 'prev_text' => '«', 'next_text' => '»', 'type' => 'list')); }
function novavideo_lite_paginate() { $big = 999999999; // need an unlikely integer global $wp_query; echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages)); }
/** * Import's History list */ public function index() { $get = $this->input->get(array('s' => '', 'order_by' => 'date', 'order' => 'DESC', 'pagenum' => 1, 'perPage' => 25, 'id' => '')); $get['pagenum'] = absint($get['pagenum']); $get['id'] = absint($get['id']); extract($get); if (!in_array($order_by, array('date', 'id', 'run_time', 'type'))) { $order_by = 'date'; } if (!in_array($order, array('DESC', 'ASC'))) { $order = 'DESC'; } if (empty($id)) { wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Import is not specified.', 'wp_all_import_plugin'))), $this->baseUrl)); die; } $this->data += $get; $by = array('import_id' => $id); $this->data['import'] = new PMXI_Import_Record(); $this->data['import']->getById($id); $list = new PMXI_History_List(); $this->data['list'] = $list->setColumns($list->getTable() . '.*')->getBy($by, "{$order_by} {$order}", $pagenum, $perPage, $list->getTable() . '.id'); $this->data['page_links'] = paginate_links(array('base' => add_query_arg(array('id' => $id, 'pagenum' => '%#%'), $this->baseUrl), 'format' => '', 'prev_text' => __('«', 'wp_all_import_plugin'), 'next_text' => __('»', 'wp_all_import_plugin'), 'total' => ceil($list->total() / $perPage), 'current' => $pagenum)); $this->render(); }
/** * Display navigation to next/previous set of posts when applicable. */ function wpmaterialdesign_paging_nav() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } ?> <nav class="navigation paging-navigation" role="navigation"> <?php global $wp_query; $big = 999999999; // need an unlikely integer $pages = paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages, 'type' => 'array')); if (is_array($pages)) { $paged = get_query_var('paged') == 0 ? 1 : get_query_var('paged'); echo '<div class="pagination-wrap"><ul class="pagination">'; foreach ($pages as $page) { echo "<li>{$page}</li>"; } echo '</ul></div>'; } ?> <!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous set of posts when applicable. * * @since Anciela 1.0 */ function anciela_paging_nav($query = null) { // Don't print empty markup if there's only one page. if ($query == null) { $query = $GLOBALS['wp_query']; } if ($query->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Plus récents', 'anciela'), 'next_text' => __('Plus anciens →', 'anciela'))); if ($links) { ?> <nav class="navigation paging-navigation" role="navigation"> <?php echo $links; ?> </nav><!-- .navigation --> <?php } }
/** * Previous Imports list */ public function index() { $get = $this->input->get(array('s' => '', 'order_by' => 'registered_on', 'order' => 'DESC', 'pagenum' => 1, 'perPage' => 25)); $get['pagenum'] = absint($get['pagenum']); extract($get); $this->data += $get; if (!in_array($order_by, array('registered_on', 'id', 'name'))) { $order_by = 'registered_on'; } if (!in_array($order, array('DESC', 'ASC'))) { $order = 'DESC'; } $list = new PMXI_Import_List(); $post = new PMXI_Post_Record(); $by = array('parent_import_id' => 0); if ('' != $s) { $like = '%' . preg_replace('%\\s+%', '%', preg_replace('/[%?]/', '\\\\$0', $s)) . '%'; $by[] = array(array('name LIKE' => $like, 'type LIKE' => $like, 'path LIKE' => $like, 'friendly_name LIKE' => $like), 'OR'); } $this->data['list'] = $list->join($post->getTable(), $list->getTable() . '.id = ' . $post->getTable() . '.import_id', 'LEFT')->setColumns($list->getTable() . '.*', 'COUNT(' . $post->getTable() . '.post_id' . ') AS post_count')->getBy($by, "{$order_by} {$order}", $pagenum, $perPage, $list->getTable() . '.id'); $this->data['page_links'] = paginate_links(array('base' => add_query_arg('pagenum', '%#%', $this->baseUrl), 'add_args' => array('page' => 'pmxi-admin-manage'), 'format' => '', 'prev_text' => __('«', 'wp_all_import_plugin'), 'next_text' => __('»', 'wp_all_import_plugin'), 'total' => ceil($list->total() / $perPage), 'current' => $pagenum)); //pmxi_session_unset(); PMXI_Plugin::$session->clean_session(); $this->render(); }
function wp_corenavi() { global $wp_query; $pages = ''; $max = $wp_query->max_num_pages; if (!($current = get_query_var('paged'))) { $current = 1; } $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999)); $a['total'] = $max; $a['current'] = $current; $total = 1; //1 - выводить текст "Страница N из N", 0 - не выводить $a['mid_size'] = 3; //сколько ссылок показывать слева и справа от текущей $a['end_size'] = 1; //сколько ссылок показывать в начале и в конце $a['prev_text'] = 'Предыдущая'; //текст ссылки "Предыдущая страница" $a['next_text'] = 'Следующая'; //текст ссылки "Следующая страница" if ($max > 1) { echo '<div class="navigation">'; } echo $pages . paginate_links($a); if ($max > 1) { echo '</div>'; } }
function bp_wire_posts_template($item_id, $component_slug, $can_post, $per_page, $max) { global $bp; if ($bp->current_component == $bp->wire->slug) { $this->table_name = $bp->profile->table_name_wire; // If the user is viewing their own wire, delete the notifications. if ('all-posts' == $bp->current_action && bp_is_home()) { bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'xprofile', 'new_wire_post'); } } else { $this->table_name = $bp->{$component_slug}->table_name_wire; } $this->pag_page = isset($_REQUEST['wpage']) ? intval($_REQUEST['wpage']) : 1; $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page; $this->wire_posts = BP_Wire_Post::get_all_for_item($item_id, $this->table_name, $this->pag_page, $this->pag_num); $this->total_wire_post_count = (int) $this->wire_posts['count']; $this->wire_posts = $this->wire_posts['wire_posts']; $this->wire_post_count = count($this->wire_posts); if ((int) get_site_option('non-friend-wire-posting') && ($bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug)) { $this->can_post = 1; } else { $this->can_post = $can_post; } $this->pag_links = paginate_links(array('base' => add_query_arg('wpage', '%#%', $bp->displayed_user->domain), 'format' => '', 'total' => ceil($this->total_wire_post_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1)); }
/** * 分頁. */ function wp_pagenavi() { global $wp_query; $_obj_post_count = wp_count_posts(); $max = ceil($_obj_post_count->publish / 6); if (!($current = get_query_var('paged'))) { $current = 1; } $args['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999)); $args['total'] = $max; $args['current'] = $current; $args['type'] = 'array'; $args['prev_text'] = '<'; $args['next_text'] = '>'; $_arr_pages = paginate_links($args); $_str_page = '<nav>'; $_str_page .= '<ul class="pagination">'; $_str_page .= '<li class="disabled"><a href="#">共' . $max . '頁</a></li>'; foreach ($_arr_pages as $key => $val) { if (substr($val, 0, 2) == '<s') { $_str_page .= '<li class="active">' . $val . '</li>'; } else { $_str_page .= '<li>' . $val . '</li>'; } } $_str_page .= '</ul>'; $_str_page .= '</nav>'; echo $_str_page; }
/** * Display navigation to next/previous set of posts when applicable. * */ function uncode_posts_navigation() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } $pagination_args = array('prev_next' => false, 'type' => 'array'); $paginate_links = paginate_links($pagination_args); if (is_array($paginate_links)) { $output = "<ul class='pagination'>"; $prev = get_previous_posts_link('<i class="fa fa-angle-left"></i>'); if ($prev !== NULL) { $output .= '<li class="page-prev">' . $prev . '</li>'; } else { $output .= '<li class="page-prev"><span class="btn btn-link btn-icon-left btn-disable-hover"><i class="fa fa-angle-left"></i></span></li>'; } foreach ($paginate_links as $page) { $output .= '<li><span class="btn-container">' . $page . '</span></li>'; } $next = get_next_posts_link('<i class="fa fa-angle-right"></i>'); if ($next !== NULL) { $output .= '<li class="page-next">' . $next . '</li>'; } else { $output .= '<li class="page-next"><span class="btn btn-link btn-icon-right btn-disable-hover"><i class="fa fa-angle-right"></i></span></li>'; } $output .= "</ul><!-- .pagination -->"; } return $output; }
function virtue_wp_pagenav() { global $wp_query, $wp_rewrite; $pages = ''; $big = 999999999; // need an unlikely integer $max = $wp_query->max_num_pages; if (!($current = get_query_var('paged'))) { $current = 1; } $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big))); $args['total'] = $max; $args['current'] = $current; $args['add_args'] = false; $total = 1; $args['mid_size'] = 3; $args['end_size'] = 1; $args['prev_text'] = '«'; $args['next_text'] = '»'; if ($max > 1) { echo '<div class="wp-pagenavi">'; } if ($total == 1 && $max > 1) { echo paginate_links($args); } if ($max > 1) { echo '</div>'; } }