当前位置: 首页>>代码示例>>PHP>>正文


PHP next_posts_link函数代码示例

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


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

示例1: woo_pagenav

    function woo_pagenav($custom_query = '')
    {
        global $woo_options, $wp_query, $paged, $page;
        // Set query max pages
        $max_pages = 1;
        if ('' != $custom_query) {
            $max_pages = $custom_query->max_num_pages;
        } else {
            $max_pages = $wp_query->max_num_pages;
        }
        // If the user has set the option to use simple paging links, display those. By default, display the pagination.
        if (@$woo_options['woo_pagination_type'] == 'simple') {
            if (get_next_posts_link('', $max_pages) || get_previous_posts_link()) {
                ?>
            <div class="nav-entries">
                <?php 
                next_posts_link('<span class="nav-prev fl"><i class="icon-angle-left"></i> ' . __('Older posts', 'woothemes') . '</span>', $max_pages);
                ?>
                <?php 
                previous_posts_link('<span class="nav-next fr">' . __('Newer posts', 'woothemes') . ' <i class="icon-angle-right"></i></span>');
                ?>
                <div class="fix"></div>
            </div>
		<?php 
            }
            // End IF Statement
        } else {
            woo_pagination(array(), $custom_query);
        }
        // End IF Statement
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:31,代码来源:theme-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: cleanblog_posts_navigation

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function cleanblog_posts_navigation()
    {
        // Don't print empty markup if there's only one page.
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return;
        }
        ?>
	<ul class="pager">
		<?php 
        if (get_next_posts_link()) {
            ?>
		<li class="next"><?php 
            next_posts_link(esc_html__('Older posts', 'cleanblog'));
            ?>
</li>
		<?php 
        }
        ?>
		<?php 
        if (get_previous_posts_link()) {
            ?>
		<li class="previous"><?php 
            previous_posts_link(esc_html__('Newer posts', 'cleanblog'));
            ?>
</li>
		<?php 
        }
        ?>
	</ul>
	<?php 
    }
开发者ID:alesanchezr,项目名称:personal-blog,代码行数:36,代码来源:template-tags.php

示例4: getpagenavi

function getpagenavi()
{
    ?>
<div id="navigation">

<?php 
    if (function_exists('wp_simple_pagination')) {
        wp_simple_pagination();
        ?>


<?php 
    } else {
        ?>
    <div class="alignleft"><?php 
        next_posts_link(__('&laquo; Старые записи', 'web2feel'));
        ?>
</div>
    <div class="alignright"><?php 
        previous_posts_link(__('Новые записи &raquo;', 'web2feel'));
        ?>
</div> 
    <div class="clear"></div>
<?php 
    }
    ?>

</div>
<?php 
}
开发者ID:pallid,项目名称:Bodriy,代码行数:30,代码来源:functions.php

示例5: tarski_posts_nav_link

/**
 * tarski_posts_nav_link() - Outputs next / previous index page links.
 * 
 * @since 1.2
 * @global object $wp_query
 * @return string
 */
function tarski_posts_nav_link()
{
    if (get_tarski_option('use_pages')) {
        global $wp_query;
        if (!is_singular()) {
            $max_num_pages = $wp_query->max_num_pages;
            $paged = get_query_var('paged');
            $sep = ' &sect; ';
            // Only have sep if there's both prev and next results
            if ($paged < 2 || $paged >= $max_num_pages) {
                $sep = '';
            }
            if ($max_num_pages > 1) {
                echo '<p class="pagination">';
                if (is_search()) {
                    previous_posts_link('&laquo; ' . __('Previous results', 'tarski'));
                    echo $sep;
                    next_posts_link(__('More results', 'tarski') . ' &raquo;');
                } else {
                    next_posts_link('&laquo; ' . __('Older entries', 'tarski'));
                    echo $sep;
                    previous_posts_link(__('Newer entries', 'tarski') . ' &raquo;');
                }
                echo "</p>\n";
            }
        }
    }
}
开发者ID:jeremylightsmith,项目名称:blog,代码行数:35,代码来源:content_helper.php

示例6: twentytwelve_content_nav

    /**
     * Displays navigation to next/previous pages when applicable.
     *
     * @since Twenty Twelve 1.0
     */
    function twentytwelve_content_nav($html_id)
    {
        global $wp_query;
        $html_id = esc_attr($html_id);
        if ($wp_query->max_num_pages > 1) {
            ?>
		<nav id="<?php 
            echo $html_id;
            ?>
" class="navigation" role="navigation">
			<h3 class="assistive-text"><?php 
            _e('Post navigation', 'twentytwelve');
            ?>
</h3>
			<div class="nav-previous"><?php 
            next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve'));
            ?>
</div>
			<div class="nav-next"><?php 
            previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve'));
            ?>
</div>
		</nav><!-- #<?php 
            echo $html_id;
            ?>
 .navigation -->
	<?php 
        }
    }
开发者ID:kaigon,项目名称:cb5.0,代码行数:34,代码来源:functions.php

示例7: zerif_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     */
    function zerif_paging_nav()
    {
        echo '<div class="clear"></div>';
        ?>
	<nav class="navigation paging-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        _e('Posts navigation', 'zerif');
        ?>
</h1>
		<div class="nav-links">
			<?php 
        if (get_next_posts_link()) {
            ?>
			<div class="nav-previous"><?php 
            next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'zerif'));
            ?>
</div>
			<?php 
        }
        ?>
			<?php 
        if (get_previous_posts_link()) {
            ?>
			<div class="nav-next"><?php 
            previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'zerif'));
            ?>
</div>
			<?php 
        }
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:37,代码来源:template-tags.php

示例8: webonary_zeedisplay_page_navigation

/**
 * Common page navigation
 */
function webonary_zeedisplay_page_navigation()
{
    if (function_exists('wp_pagenavi')) {
        // if PageNavi is activated
        ?>
		<div class="more_posts">
			<?php 
        wp_pagenavi();
        // Use PageNavi
        ?>
		</div>
	<?php 
    } else {
        // Otherwise, use traditional Navigation
        ?>
		<div class="more_posts">
			<span class="post_links">
				<?php 
        previous_posts_link(__('&laquo; Previous Entries', ZEE_LANG));
        ?>
				<?php 
        next_posts_link(__('Next Entries &raquo;', ZEE_LANG)) & nbsp;
        ?>
			</span>
		</div>
	<?php 
    }
}
开发者ID:rick-maclean,项目名称:webonaryLinuxCopy,代码行数:31,代码来源:navigation.php

示例9: section_template

    function section_template()
    {
        ?>
		<?php 
        if (function_exists('wp_pagenavi') && show_posts_nav() && VPRO) {
            ?>
 
			<?php 
            wp_pagenavi();
            ?>
  
		<?php 
        } elseif (show_posts_nav()) {
            ?>
			<div class="page-nav-default fix">
				<span class="previous-entries"><?php 
            next_posts_link(__('&larr; Previous Entries', 'pagelines'));
            ?>
</span>
				<span class="next-entries"><?php 
            previous_posts_link(__('Next Entries &rarr;', 'pagelines'));
            ?>
</span>
			</div><!-- page nav -->
		<?php 
        }
        ?>
		
	<?php 
    }
开发者ID:rohans,项目名称:tradeinbooks,代码行数:30,代码来源:section.pagination.php

示例10: orbit_content_nav

    /**
     * Display navigation to next/previous pages when applicable
     */
    function orbit_content_nav($nav_id)
    {
        global $wp_query;
        ?>
	<nav id="<?php 
        echo $nav_id;
        ?>
">
		<ul>
		<?php 
        if (is_single()) {
            // navigation links for single posts
            ?>
		
			<li><?php 
            previous_post_link('%link', '' . _x('&larr;', 'Previous post link', 'orbit') . '%title');
            ?>
</li>
			<li><?php 
            next_post_link('%link', '%title' . _x('&rarr;', 'Next post link', 'orbit') . '');
            ?>
</li>

		<?php 
        } elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
            // navigation links for home, archive, and search pages
            ?>

			<?php 
            if (get_next_posts_link()) {
                ?>
				<li><?php 
                next_posts_link(__('&larr; Older posts', 'orbit'));
                ?>
</li>
			<?php 
            }
            ?>

			<?php 
            if (get_previous_posts_link()) {
                ?>
				<li><?php 
                previous_posts_link(__('Newer posts &rarr;', 'orbit'));
                ?>
</li>
			<?php 
            }
            ?>

		<?php 
        }
        ?>
		</ul>
	</nav><!-- #<?php 
        echo $nav_id;
        ?>
 -->
	<?php 
    }
开发者ID:ryanurban,项目名称:Orbit,代码行数:63,代码来源:required.php

示例11: comicpress_pagination

function comicpress_pagination()
{
    global $post, $wp_query;
    if (function_exists('wp_pagenavi')) {
        ?>
		<?php 
        wp_pagenavi('<div id="wp-paginav">', '<div class="clear"></div></div>');
        ?>
	<?php 
    } else {
        ?>
		<div id="pagenav">
		<div class="pagenav-right"><?php 
        previous_posts_link(__('Newer Entries &uarr;', 'comicpress'));
        ?>
</div>
		<div class="pagenav-left"><?php 
        next_posts_link(__('&darr; Previous Entries', 'comicpress'));
        ?>
</div>
		<div class="clear"></div>
		</div>
	<?php 
    }
}
开发者ID:johnbintz,项目名称:comicpress-2.8,代码行数:25,代码来源:pagination.php

示例12: silencio_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @return void
     */
    function silencio_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">
            <div class="nav-links">

<?php 
        if (get_next_posts_link()) {
            ?>
                <div class="nav-previous"><?php 
            next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'silencio'));
            ?>
</div>
<?php 
        }
        if (get_previous_posts_link()) {
            ?>
                <div class="nav-next"><?php 
            previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'silencio'));
            ?>
</div>
<?php 
        }
        ?>

            </div><!-- .nav-links -->
        </nav><!-- .navigation -->
<?php 
    }
开发者ID:shawncoots,项目名称:ehrlers,代码行数:38,代码来源:template-tags.php

示例13: cd_posts_navigation

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function cd_posts_navigation()
    {
        // Don't print empty markup if there's only one page.
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return;
        }
        ?>
	<nav class="navigation posts-navigation" role="navigation">
		<h2 class="screen-reader-text"><?php 
        _e('Posts navigation', 'codediva');
        ?>
</h2>
		<div class="nav-links">

			
			<div class="nav-previous"><?php 
        next_posts_link(__('&larr; Older posts', 'underscores'));
        ?>
</div>
			
			
			<div class="nav-next"><?php 
        previous_posts_link(__('Newer posts &rarr;', 'underscores'));
        ?>
</div>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:syedhasb,项目名称:fluffy,代码行数:34,代码来源:template-tags.php

示例14: teaberry_content_nav

/**
 * displays navigation to next/previous pages when applicable.
 */
function teaberry_content_nav($html_id)
{
    global $wp_query;
    $html_id = esc_attr($html_id);
    if ($wp_query->max_num_pages > 1) {
        ?>

        <nav id="<?php 
        echo $html_id;
        ?>
" class="navigation" role="navigation">

            <div class="nav-previous">
                <?php 
        $text = __('<span class="meta-nav">&larr;</span> Older posts', 'teaberry');
        next_posts_link($text);
        ?>
            </div>

            <div class="nav-next">
                <?php 
        $text = __('Newer posts <span class="meta-nav">&rarr;</span>', 'teaberry');
        previous_posts_link($text);
        ?>
            </div>

        </nav><!-- #<?php 
        echo $html_id;
        ?>
 .navigation -->

    <?php 
    }
}
开发者ID:honeymustard,项目名称:teaberry,代码行数:37,代码来源:page.php

示例15: chivenewengland_content_nav

    /**
     * Displays navigation to next/previous pages when applicable.
     *
     * @since Twenty Twelve 1.0
     */
    function chivenewengland_content_nav($html_id)
    {
        global $wp_query;
        if ($wp_query->max_num_pages > 1) {
            ?>
            <nav id="<?php 
            echo esc_attr($html_id);
            ?>
" class="navigation" role="navigation">
                <ul class="pager">
                    <li class="previous">
                        <?php 
            next_posts_link(__('<i class="fa fa-chevron-left fa-fw"></i> Older', 'chivenewengland'));
            ?>
                    </li>
                    <li class="next">
                        <?php 
            previous_posts_link(__('Newer <i class="fa fa-chevron-right fa-fw"></i>', 'chivenewengland'));
            ?>
                    </li>
                </ul>
            </nav><!-- .navigation -->
        <?php 
        }
    }
开发者ID:alexjustesen,项目名称:chivenewengland,代码行数:30,代码来源:navigation.php


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