• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_pagenum_link函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_pagenum_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pagenum_link函数的具体用法?PHP get_pagenum_link怎么用?PHP get_pagenum_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_pagenum_link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wp_corenavi

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">';
    }
    if ($total == 1 && $max > 1) {
        $pages = '<span class="pages">Страница ' . $current . ' из ' . $max . '</span>' . "\r\n";
    }
    echo $pages . paginate_links($a);
    if ($max > 1) {
        echo '</div>';
    }
}
开发者ID:king199025,项目名称:Fox-Kids,代码行数:32,代码来源:functions.php


示例2: page_navi

function page_navi($before = '', $after = '')
{
    global $wpdb, $wp_query;
    $request = $wp_query->request;
    $posts_per_page = intval(get_query_var('posts_per_page'));
    $paged = intval(get_query_var('paged'));
    $numposts = $wp_query->found_posts;
    $max_page = $wp_query->max_num_pages;
    if ($numposts <= $posts_per_page) {
        return;
    }
    if (empty($paged) || $paged == 0) {
        $paged = 1;
    }
    $pages_to_show = 3;
    $pages_to_show_minus_1 = $pages_to_show - 1;
    $half_page_start = floor($pages_to_show_minus_1 / 2);
    $half_page_end = ceil($pages_to_show_minus_1 / 2);
    $start_page = $paged - $half_page_start;
    if ($start_page <= 0) {
        $start_page = 1;
    }
    $end_page = $paged + $half_page_end;
    if ($end_page - $start_page != $pages_to_show_minus_1) {
        $end_page = $start_page + $pages_to_show_minus_1;
    }
    if ($end_page > $max_page) {
        $start_page = $max_page - $pages_to_show_minus_1;
        $end_page = $max_page;
    }
    if ($start_page <= 0) {
        $start_page = 1;
    }
    echo $before . '<div class="pagination_wrapper"><ul class="pagination">' . "";
    if ($paged > 1) {
        $first_page_text = "First";
        echo '<li class="prev"><a href="' . get_pagenum_link() . '" title="First">' . $first_page_text . '</a></li>';
    }
    $prevposts = get_previous_posts_link('Prev');
    if ($prevposts) {
        echo '<li>' . $prevposts . '</li>';
    } else {
        echo '<li class="disabled"><a href="#">Prev</a></li>';
    }
    for ($i = $start_page; $i <= $end_page; $i++) {
        if ($i == $paged) {
            echo '<li class="active"><a href="#">' . $i . '</a></li>';
        } else {
            echo '<li><a href="' . get_pagenum_link($i) . '">' . $i . '</a></li>';
        }
    }
    if ($end_page < $max_page) {
        $last_page_text = $max_page;
        echo '<li class="next"><a href="' . get_pagenum_link($max_page) . '" title="Last">' . $last_page_text . '</a></li>';
    }
    echo '<li class="">';
    next_posts_link('Next');
    echo '</li>';
    echo '</ul></div>' . $after . "";
}
开发者ID:madeloa,项目名称:holmesdev,代码行数:60,代码来源:pagination.php


示例3: farmtoyou_paging_nav

    /**
     * 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' => __('&larr; Previous', 'farmtoyou'), 'next_text' => __('Next &rarr;', 'farmtoyou')));
        if ($links) {
            ?>
	<nav class="navigation paging-navigation" role="navigation">
		<div class="pagination loop-pagination">
			<?php 
            echo $links;
            ?>
		</div><!-- .pagination -->
	</nav><!-- .navigation -->
	<?php 
        }
    }
开发者ID:abcode619,项目名称:wpstuff,代码行数:40,代码来源:template-tags.php


示例4: createPagination

    function createPagination($query)
    {
        global $wp_rewrite;
        $total = $query->max_num_pages;
        $current = max(1, ThemeHelper::getPageNumber());
        $Validation = new ThemeValidation();
        $pagination = array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current, 'total' => $total, 'next_text' => __(' >', THEME_CONTEXT), 'prev_text' => __('< ', THEME_CONTEXT));
        if ($wp_rewrite->using_permalinks()) {
            $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
        }
        if (is_search()) {
            $pagination['add_args'] = array('s' => urlencode(get_query_var('s')));
        }
        $html = paginate_links($pagination);
        if ($Validation->isNotEmpty($html)) {
            $html = '
				<div class="theme-blog-pagination-box">
					<div class="theme-blog-pagination">
						' . $html . '
					</div>
				</div>
			';
        }
        return $html;
    }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:25,代码来源:Theme.Blog.class.php


示例5: wpmaterialdesign_paging_nav

    /**
     * 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 
    }
开发者ID:WordPress-UiGEN-resources,项目名称:Material-World-WP-Theme,代码行数:31,代码来源:template-tags.php


示例6: novavideo_lite_paginate

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));
}
开发者ID:ChuanGz,项目名称:Source_web,代码行数:7,代码来源:utils.php


示例7: flat_paging_nav

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 
    }
}
开发者ID:pivaker,项目名称:driverschool,代码行数:32,代码来源:template-tags.php


示例8: gazeta_the_posts_pagination

 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>';
         }
     }
 }
开发者ID:alvarpoon,项目名称:get-it-write,代码行数:34,代码来源:templates.php


示例9: wp_smart_pagination

	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	
	
	}
开发者ID:johnmanlove,项目名称:Bridgeland,代码行数:26,代码来源:wp-smart-pagination.php


示例10: digitalstore_pagination

/**
 * 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' => __('&laquo;', 'edd-digitalstore'), 'next_text' => __('&raquo;', '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;
    }
}
开发者ID:SelaInc,项目名称:Digital-Store,代码行数:38,代码来源:pagination.php


示例11: virtue_wp_pagenav

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>';
    }
}
开发者ID:aguerojahannes,项目名称:aguerojahannes.com,代码行数:29,代码来源:custom.php


示例12: flatbook_post_pagination

 function flatbook_post_pagination($pages = '', $range = 8)
 {
     $showitems = $range * 2 + 1;
     global $paged;
     if (empty($paged)) {
         $paged = 1;
     }
     if ($pages == '') {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
         if (!$pages) {
             $pages = 1;
         }
     }
     if (1 != $pages) {
         echo '<nav class="blog-pagination">';
         echo '<ul class="pagination">';
         for ($i = 1; $i <= $pages; $i++) {
             if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
                 echo $paged == $i ? '<li class="active"><span class="page-number current">' . $i . '</span></li>' : '<li><a href="' . esc_url(get_pagenum_link($i)) . '" class="page-number inactive" >' . $i . '</a></li>';
             }
         }
         echo '</ul>';
         $paged = get_query_var('paged') ? get_query_var('paged') : 1;
         echo '<p class="page-indicator">';
         printf(__('Page %1$s of %2$s', 'flatbook'), $paged, $wp_query->max_num_pages);
         echo '</p>';
         echo '</nav>';
     }
 }
开发者ID:de190909,项目名称:WPTest,代码行数:30,代码来源:template-tags.php


示例13: mp_core_paginate_links

 function mp_core_paginate_links($args = array())
 {
     global $wp_query;
     if (get_query_var('paged')) {
         $current_page = get_query_var('paged');
     } else {
         if (get_query_var('page')) {
             $current_page = get_query_var('page');
         } else {
             $current_page = 1;
         }
     }
     $permalink_structure = get_option('permalink_structure');
     $format = empty($permalink_structure) ? '?page=%#%' : 'page/%#%/';
     //Split the current url at the question mark
     $url_args = explode('?', $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
     //If there is a question mark, store everything after it in url_args with a question mark
     $url_args = isset($url_args[1]) ? '?' . $url_args[1] : NULL;
     //This array stores all of the args (eg: ?s=MyTestSearch) that could be in the url. You can add your own using the filter 'mp_core_pagination_arg_remover'
     $array_of_url_args_to_remove = apply_filters('mp_core_pagination_arg_remover', array('s'));
     $defaults = array('total' => $wp_query->max_num_pages, 'base' => mp_core_remove_query_arg($array_of_url_args_to_remove, html_entity_decode(get_pagenum_link(1))) . '%_%' . $url_args, 'format' => $format, 'current' => $current_page, 'prev_next' => true, 'prev_text' => apply_filters('mp_core_pagination_prev', '<'), 'next_text' => apply_filters('mp_core_pagination_prev', '>'), 'type' => 'list', 'show_all' => false);
     $args = wp_parse_args($args, $defaults);
     echo '<nav id="posts-navigation" class="row pagination mp-core-pagination">';
     echo paginate_links(apply_filters('mp_core_pagination', $args));
     echo '</nav>';
 }
开发者ID:arrezende,项目名称:promillus,代码行数:26,代码来源:pagination.php


示例14: pagenav

function pagenav($query_string)
{
    global $posts_per_page, $paged;
    $my_query = new WP_Query($query_string . "&posts_per_page=-1");
    $total_posts = $my_query->post_count;
    if (empty($paged)) {
        $paged = 1;
    }
    $prev = $paged - 1;
    $next = $paged + 1;
    $range = 4;
    // only edit this if you want to show more page-links
    $showitems = $range * 2 + 1;
    $pages = ceil($total_posts / $posts_per_page);
    if (1 != $pages) {
        echo "<div class='pagination'>";
        echo $paged > 2 && $paged + $range + 1 > $pages && $showitems < $pages ? "<a href='" . get_pagenum_link(1) . "'>最前</a>" : "";
        echo $paged > 1 && $showitems < $pages ? "<a href='" . get_pagenum_link($prev) . "'>上一页</a>" : "";
        for ($i = 1; $i <= $pages; $i++) {
            if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
                echo $paged == $i ? "<span class='current'>" . $i . "</span>" : "<a href='" . get_pagenum_link($i) . "' class='inactive' >" . $i . "</a>";
            }
        }
        echo $paged < $pages && $showitems < $pages ? "<a href='" . get_pagenum_link($next) . "'>下一页</a>" : "";
        echo $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ? "<a href='" . get_pagenum_link($pages) . "'>最后</a>" : "";
        echo "</div>\n";
    }
}
开发者ID:KaiYangCHN,项目名称:WordPress,代码行数:28,代码来源:functions.php


示例15: optimizer_pagination

function optimizer_pagination($navigation = 'numbered', $query = '')
{
    ?>
		<?php 
    if ($navigation !== 'no_nav') {
        ?>
				<?php 
        if ($navigation == 'numbered' || $navigation == 'numbered_ajax') {
            ?>
					<div class="ast_pagenav">
                        <?php 
            if ($query == '') {
                global $wp_query;
                $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, 'show_all' => true, 'prev_next' => false, 'add_args' => false));
            } else {
                if ($query !== '') {
                    $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' => $query->max_num_pages, 'show_all' => true, 'prev_next' => false, 'add_args' => false));
                }
            }
            ?>
                    </div>
                <?php 
        }
        ?>
        <?php 
    }
}
开发者ID:jojo1311,项目名称:myBlogDesign,代码行数:31,代码来源:core-pagination.php


示例16: themefusion_pagination

 function themefusion_pagination($pages = '', $range = 2)
 {
     global $data;
     $showitems = $range * 2 + 1;
     global $paged;
     if (empty($paged)) {
         $paged = 1;
     }
     if ($pages == '') {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
         if (!$pages) {
             $pages = 1;
         }
     }
     if (1 != $pages) {
         echo "<div class='pagination clearfix'>";
         //if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'><span class='arrows'>&laquo;</span> First</a>";
         if ($paged > 1) {
             echo "<a class='pagination-prev' href='" . get_pagenum_link($paged - 1) . "'><span class='page-prev'></span>" . __('Previous', 'Avada') . "</a>";
         }
         for ($i = 1; $i <= $pages; $i++) {
             if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
                 echo $paged == $i ? "<span class='current'>" . $i . "</span>" : "<a href='" . get_pagenum_link($i) . "' class='inactive' >" . $i . "</a>";
             }
         }
         if ($paged < $pages) {
             echo "<a class='pagination-next' href='" . get_pagenum_link($paged + 1) . "'>" . __('Next', 'Avada') . "<span class='page-next'></span></a>";
         }
         //if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last <span class='arrows'>&raquo;</span></a>";
         echo "</div>\n";
     }
 }
开发者ID:bulats,项目名称:chef,代码行数:33,代码来源:custom_functions.php


示例17: setup

 protected function setup()
 {
     // the boring defaults that are ommited in the wpgrade-config.php
     // configuration for clarity and bravity, and also because some require
     // extensive logic handling
     $defaults = array('base' => str_replace(999999999, '%#%', esc_url(get_pagenum_link(999999999))), 'format' => $this->pager_format($this->pager), 'current' => max(1, get_query_var($this->pager)), 'total' => $this->query->max_num_pages, 'formatter' => null, 'prev_next' => true, 'sorted_paging' => false, 'order' => 'desc', 'show_all' => false, 'end_size' => 1, 'mid_size' => 2, 'add_args' => false, 'add_fragment' => null);
     $conf = wpgrade::merge($defaults, $this->conf);
     # we're filling in prev_text and next_text seperatly to avoid
     # requesting the translation when not required
     if (empty($conf['prev_text'])) {
         $conf['prev_text'] = __('&laquo; Previous', 'rosa_txtd');
     } else {
         // exists; translate
         $conf['prev_text'] = __($conf['prev_text'], 'rosa_txtd');
     }
     if (empty($conf['next_text'])) {
         $conf['next_text'] = __('Next &raquo;', 'rosa_txtd');
     } else {
         // exists; translate
         $conf['next_text'] = __($conf['next_text'], 'rosa_txtd');
     }
     // is the pager sorted?
     if ($conf['sorted_paging'] && $conf['order'] == 'asc') {
         $temp = $conf['prev_text'];
         $conf['prev_text'] = $conf['next_text'];
         $conf['next_text'] = $temp;
     }
     return $conf;
 }
开发者ID:pwzCypher,项目名称:wp-push,代码行数:29,代码来源:WPGradePaginationFormatter.php


示例18: kad_wp_pagenavi

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'] = '&laquo;';
    $args['next_text'] = '&raquo';
    if ($max > 1) {
        echo '<div class="wp-pagenavi">';
    }
    if ($total == 1 && $max > 1) {
        echo paginate_links($args);
    }
    if ($max > 1) {
        echo '</div>';
    }
}
开发者ID:Joaquinsemp,项目名称:patriestausado,代码行数:26,代码来源:custom.php


示例19: pagination

    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 
        }
    }
开发者ID:pcco,项目名称:portal-redesign,代码行数:33,代码来源:pagination.php


示例20: nexus_pagination

function nexus_pagination()
{
    $prev_arrow = is_rtl() ? '&laquo;' : '&laquo;';
    $next_arrow = is_rtl() ? '&raquo;' : '&raquo;';
    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">&nbsp;</div></div>	';
        }
    }
}
开发者ID:alexandruspataru,项目名称:Starter,代码行数:28,代码来源:actions.php



注:本文中的get_pagenum_link函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_pager函数代码示例发布时间:2022-05-15
下一篇:
PHP get_paged_template函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap