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


PHP next_post_link函数代码示例

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


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

示例1: dswoddil_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @since DSW oddil 1.0
     */
    function dswoddil_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'dswoddil');
        ?>
</h1>
		<div class="nav-links">
			<?php 
        if (is_attachment()) {
            previous_post_link('%link', __('<span class="meta-nav">Published In</span>%title', 'dswoddil'));
        } else {
            previous_post_link('%link', __('<span class="meta-nav">Previous Post</span>%title', 'dswoddil'));
            next_post_link('%link', __('<span class="meta-nav">Next Post</span>%title', 'dswoddil'));
        }
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:kalich5,项目名称:dsw-oddil,代码行数:32,代码来源:template-tags.php

示例2: sf_display_nav

function sf_display_nav($navstyle = "nextprev", $class = "navigation")
{
    if (is_single()) {
        echo '<div class="' . $class . '"> <!-- BEGIN .' . $class . ' -->';
        echo '<div class="left">';
        previous_post_link();
        echo '</div>';
        echo '<div class="right">';
        next_post_link();
        echo '</div>';
        echo '</div> <!-- END .' . $class . ' -->';
    } else {
        $_SERVER['REQUEST_URI'] = preg_replace("/(.*?).php(.*?)&(.*?)&(.*?)&_=/", "\$2\$3", $_SERVER['REQUEST_URI']);
        echo '<div class="' . $class . '"> <!-- BEGIN .' . $class . ' -->';
        if ($navstyle == "nextprev") {
            echo '<div class="left">';
            next_posts_link('&laquo; Older Entries');
            echo '</div>';
            echo '<div class="right">';
            previous_posts_link('Newer Entries &raquo;');
            echo '</div>';
        } elseif ($navstyle == "numbar") {
            sf_corenav();
        }
        echo '</div> <!-- END .' . $class . ' -->';
    }
}
开发者ID:ksolomon,项目名称:Solo-Frame,代码行数:27,代码来源:library.php

示例3: my_simone_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function my_simone_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
    <div class="post-nav-box clear">
        <h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'my-simone');
        ?>
</h1>
        <div class="nav-links">
            <?php 
        previous_post_link('<div class="nav-previous"><div class="nav-indicator">' . _x('Previous Post:', 'Previous post', 'my-simone') . '</div><h1>%link</h1></div>', '%title');
        next_post_link('<div class="nav-next"><div class="nav-indicator">' . _x('Next Post:', 'Next post', 'my-simone') . '</div><h1>%link</h1></div>', '%title');
        ?>
        </div><!-- .nav-links -->
    </div><!-- .post-nav-box -->
</nav><!-- .navigation -->

			
	<?php 
    }
开发者ID:sintija,项目名称:wordpress_backup,代码行数:32,代码来源:template-tags.php

示例4: wpsp_the_post_navigation

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function wpsp_the_post_navigation()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        /*$post_category_ids = wp_get_post_categories( get_the_ID(), array('fields' => 'ids') );
        	$category_ids = array();
        	foreach ( $post_category_ids as $cat ) {
        		$category = get_category( $cat );
        		array_push( $category_ids, $category->category_parent );
        	}
        	print_r( $category_ids );*/
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
	    <div class="post-nav-box clearfix">
	        <h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'klahan9');
        ?>
</h1>
	        <div class="nav-links">
	            <?php 
        previous_post_link('<div class="nav-previous"><div class="nav-indicator">' . _x('Previous Post:', 'Previous post', 'klahan9') . '</div><h1>%link</h1></div>', '%title', true);
        next_post_link('<div class="nav-next"><div class="nav-indicator">' . _x('Next Post:', 'Next post', 'klahan9') . '</div><h1>%link</h1></div>', '%title', true);
        ?>
	        </div><!-- .nav-links -->
	    </div><!-- .post-nav-box -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:sptheme,项目名称:klahan9,代码行数:37,代码来源:theme-functions.php

示例5: blue_planet_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @deprecated 2.1 Use the_post_navigation()
     */
    function blue_planet_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
		<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        esc_html_e('Post navigation', 'blue-planet');
        ?>
</h1>
		<div class="nav-links">
			<?php 
        previous_post_link('%link', '<span class="meta-nav">&larr;</span> %title');
        ?>
			<?php 
        next_post_link('%link', '%title <span class="meta-nav">&rarr;</span>');
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:jbbythebch,项目名称:client1wp_test,代码行数:30,代码来源:template-tags.php

示例6: flat_post_nav

    function flat_post_nav()
    {
        global $post;
        $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
			<nav class="navigation post-navigation" role="navigation">
					<h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'flat');
        ?>
</h1>
					<div class="nav-links">

							<?php 
        previous_post_link('%link', _x('<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'flat'));
        ?>
							<?php 
        next_post_link('%link', _x('%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'flat'));
        ?>

					</div>
			</nav>
			<?php 
    }
开发者ID:pivaker,项目名称:driverschool,代码行数:27,代码来源:template-tags.php

示例7: homeword_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function homeword_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<h1 class="assistive-text"><?php 
        _e('Post navigation', 'homeword');
        ?>
</h1>
		<div class="nav-links">

			<?php 
        previous_post_link('%link', _x('<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'homeword'));
        ?>
			<?php 
        next_post_link('%link', _x('%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'homeword'));
        ?>

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

示例8: activetheme_post_nav

    /**
     * Displays navigation to next/previous post when applicable.
    *
    * @since Twenty Thirteen 1.0
    *
    * @return void
    */
    function activetheme_post_nav()
    {
        global $post;
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<?php 
        /* <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'activetheme' ); ?></h1> */
        ?>
		<div class="nav-links clearfix">
		
			<?php 
        if (is_singular('article')) {
            previous_post_link('%link', _x('<span class="meta-nav meta-nav-prev">&larr;</span> Previous Article', 'Previous article link', 'activetheme'));
            next_post_link('%link', _x('Next Article <span class="meta-nav meta-nav-next">&rarr;</span>', 'Next article link', 'activetheme'));
        } else {
            previous_post_link('%link', _x('<span class="meta-nav meta-nav-prev">&larr;</span> Previous Post', 'Previous post link', 'activetheme'));
            next_post_link('%link', _x('Next Post <span class="meta-nav meta-nav-next">&rarr;</span>', 'Next post link', 'activetheme'));
        }
        ?>

		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:TaylorFoster90,项目名称:Breton-Bay,代码行数:37,代码来源:pager.php

示例9: prev_next_post_link

function prev_next_post_link()
{
    $prev_post = get_previous_post();
    $next_post = get_next_post();
    ?>
  <div id="post_nav">
    <?php 
    if ($prev_post) {
        ?>
      <div id="prev_post">
        <?php 
        previous_post_link('%link', '&#8656;%title', false);
        ?>
      </div>
    <?php 
    }
    ?>
    <?php 
    if ($next_post) {
        ?>
      <div id="next_post">
        <?php 
        next_post_link('%link', '%title&#8658;', false);
        ?>
      </div>
    <?php 
    }
    ?>
  </div>
<?php 
}
开发者ID:kenyakodaira,项目名称:kenyanke,代码行数:31,代码来源:template-prev-next-link.php

示例10: the_post_navigation

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function the_post_navigation()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
        <nav class="navigation post-navigation" role="navigation">
            <h2 class="screen-reader-text"><?php 
        _e('Post navigation', 'ncssm_sg');
        ?>
</h2>

            <div class="nav-links">
                <?php 
        previous_post_link('<div class="nav-previous">%link</div>', '%title');
        next_post_link('<div class="nav-next">%link</div>', '%title');
        ?>
            </div>
            <!-- .nav-links -->
        </nav><!-- .navigation -->
        <?php 
    }
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:30,代码来源:template-tags.php

示例11: apostrophe_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function apostrophe_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
		<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        esc_html_e('Post navigation', 'apostrophe');
        ?>
</h1>
		<div class="nav-links">
			<div class="nav-previous">
			<?php 
        previous_post_link('%link', '<span class="meta-nav">' . _x('Previous', 'Previous post link', 'apostrophe') . '</span> <span class="apostrophe-post-title">%title</span>');
        ?>
			</div>
			<div class="nav-next">
				<?php 
        next_post_link('%link', '<span class="meta-nav">' . _x('Next', 'Next post link', 'apostrophe') . '</span> <span class="apostrophe-post-title">%title</span>');
        ?>
			</div>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:glugpace,项目名称:glugpace.org,代码行数:34,代码来源:template-tags.php

示例12: zerif_post_nav

    /**
    * Display navigation to next/previous post when applicable.
    */
    function zerif_post_nav()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>

	<nav class="navigation post-navigation">

		<h2 class="screen-reader-text"><?php 
        _e('Post navigation', 'zerif-lite');
        ?>
</h2>

		<div class="nav-links">

			<?php 
        previous_post_link('<div class="nav-previous">%link</div>', _x('<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'zerif-lite'));
        next_post_link('<div class="nav-next">%link</div>', _x('%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'zerif-lite'));
        ?>

		</div><!-- .nav-links -->

	</nav><!-- .navigation -->

	<?php 
    }
开发者ID:JasonAJames,项目名称:jasonajamescom,代码行数:33,代码来源:template-tags.php

示例13: sunspot_content_nav

/**
 * Display navigation to next/previous pages when applicable
 *
 * @since Sunspot 1.0
 */
function sunspot_content_nav( $nav_id ) {
	global $wp_query;

	$nav_class = 'site-navigation paging-navigation';
	if ( is_single() )
		$nav_class = 'site-navigation post-navigation';

	?>
	<nav role="navigation" id="<?php echo $nav_id; ?>" class="<?php echo $nav_class; ?>">
		<h1 class="assistive-text"><?php _e( 'Post navigation', 'sunspot' ); ?></h1>

	<?php if ( is_single() ) : // navigation links for single posts ?>

		<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'sunspot' ) . '</span> %title' ); ?>
		<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'sunspot' ) . '</span>' ); ?>

	<?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() ) : ?>
		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'sunspot' ) ); ?></div>
		<?php endif; ?>

		<?php if ( get_previous_posts_link() ) : ?>
		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'sunspot' ) ); ?></div>
		<?php endif; ?>

	<?php endif; ?>

	</nav><!-- #<?php echo $nav_id; ?> -->
	<?php
}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:36,代码来源:template-tags.php

示例14: twentythirteen_post_nav

    /**
     * Displays navigation to next/previous post when applicable.
    *
    * @since Twenty Thirteen 1.0
    *
    * @return void
    */
    function twentythirteen_post_nav()
    {
        global $post;
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        _e('Post navigation', 'twentythirteen');
        ?>
</h1>
		<div class="nav-links">

			<?php 
        /*
        			if ( ! next_post_link('%link') ) {
        			  echo "Test!";
        			}
        */
        previous_post_link('%link', _x('<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'twentythirteen'), $in_same_cat = true);
        ?>
			<?php 
        next_post_link('%link', _x('%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'twentythirteen'), $in_same_cat = true);
        ?>

		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:verbazend,项目名称:AWFA,代码行数:40,代码来源:functions.php

示例15: the_post_navigation

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @todo Remove this function when WordPress 4.3 is released.
     */
    function the_post_navigation()
    {
        // Don't print empty markup if there's nowhere to navigate.
        $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
        $next = get_adjacent_post(false, '', false);
        if (!$next && !$previous) {
            return;
        }
        ?>
	<nav class="navigation post-navigation col-xs-12" role="navigation">
			<h2 class="screen-reader-text"><?php 
        _e('Post navigation', 'flat-sassy-boots');
        ?>
</h2>
			<div class="nav-links"> 
				<?php 
        //previous_post_link( '<div class="nav-previous"><div class="nav-indicator">' . _x( 'Previous Post:', 'Previous post', 'flat-sassy-boots' ) . '</div><h1>%link</h1><i class="fa fa-arrow-left"></i></div>', '%title' );
        //next_post_link(     '<div class="nav-next"><div class="nav-indicator">' . _x( 'Next Post:', 'Next post', 'flat-sassy-boots' ) . '</div><h1>%link</h1><i class="fa fa-arrow-right"></i></div>', '%title' );
        previous_post_link('<div class="nav-previous"><strong>%link</strong></div>', '%title');
        next_post_link('<div class="nav-next"><strong>%link</strong></div>', '%title');
        ?>
			</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:love4code,项目名称:flat-sassy-boots,代码行数:30,代码来源:template-tags.php


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