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


PHP get_adjacent_post函数代码示例

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


在下文中一共展示了get_adjacent_post函数的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: post_nav

/**
 * Display navigation to next/previous post when applicable.
 */
function 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 || is_singular('page')) {
        return;
    }
    $_previous_post_link = get_previous_post_link('<div class="nav-previous">%link</div>', _x('<span class="meta-nav">&larr;</span>&nbsp;%title', 'Previous post link', 'the-one'));
    $_next_post_link = get_next_post_link('<div class="nav-next">%link</div>', _x('%title&nbsp;<span class="meta-nav">&rarr;</span>', 'Next post link', 'the-one'));
    ?>
	<nav class="navigation post-navigation" role="navigation">
		<h4 class="screen-reader-text"><?php 
    _e('Post navigation', 'the-one');
    ?>
</h4>

		<div class="nav-links">
			<?php 
    if (!empty($_previous_post_link) && !empty($_next_post_link)) {
        echo $_previous_post_link . $_next_post_link;
    } elseif (!empty($_previous_post_link)) {
        echo $_previous_post_link;
    } elseif (!empty($_next_post_link)) {
        echo '<div class="nav-previous"></div>' . $_next_post_link;
    }
    ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
}
开发者ID:thefrosty,项目名称:The-One-Theme,代码行数:34,代码来源:template-tags.php

示例3: 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

示例4: panopta2014_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @since Twenty Fourteen 1.0
     *
     * @return void
     */
    function panopta2014_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;
        }
        ?>
	<div class="row">
		<div class="col-xs-12 col-sm-11 col-sm-offset-1">
			<nav class="navigation post-navigation" role="navigation">
				<div class="nav-links row">
					<?php 
        if (is_attachment()) {
            previous_post_link('%link', __('<div class="col-xs-12"><span class="meta-nav">Published In</span>%title</div>', 'twentyfourteen'));
        } else {
            previous_post_link('<div class="col-xs-12 col-sm-6">%link</div>', __('<i class="fa fa-angle-left"></i> <span class="meta-nav">Previous: </span>%title', 'twentyfourteen'));
            next_post_link('<div class="col-xs-12 col-sm-6">%link</div>', __('<span class="meta-nav">Next: </span>%title <i class="fa fa-angle-right"></i>', 'twentyfourteen'));
        }
        ?>
				</div><!-- .nav-links -->
			</nav><!-- .navigation -->
		</div>
	</div>
	<?php 
    }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:34,代码来源:functions.php

示例5: 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" role="navigation">

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

		<div class="row nav-links">


			<?php 
        previous_post_link('<div class="col-md-4 text-left nav-previous">%link</div>', _x('<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'zerif-lite'));
        echo '<div class="col-md-4 text-center"><a href="http://localhost/blog">Home</a></div>';
        next_post_link('<div class="col-md-4 text-right nav-next">%link</div>', _x('%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'zerif-lite'));
        ?>

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

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

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

示例6: twentyfifteen_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @since Twenty Fifteen 1.0
     */
    function twentyfifteen_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 || is_attachment() && 'attachment' == $previous->post_type) {
            return;
        }
        $prev_class = $next_class = '';
        if ($previous && has_post_thumbnail($previous->ID)) {
            $prev_class = " has-post-thumbnail";
        }
        if ($next && has_post_thumbnail($next->ID)) {
            $next_class = " has-post-thumbnail";
        }
        ?>
	<nav class="navigation post-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        esc_html_e('Post navigation', 'twentyfifteen');
        ?>
</h1>
		<div class="nav-links">
			<?php 
        if (is_attachment()) {
            previous_post_link('<div class="nav-previous' . $prev_class . '">%link</div>', _x('<span class="meta-nav">Published In</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen'));
        } else {
            previous_post_link('<div class="nav-previous' . $prev_class . '">%link</div>', _x('<span class="meta-nav">Previous</span><span class="post-title">%title</span>', 'Previous post link', 'twentyfifteen'));
            next_post_link('<div class="nav-next' . $next_class . '">%link</div>', _x('<span class="meta-nav">Next</span><span class="post-title">%title</span>', 'Next post link', 'twentyfifteen'));
        }
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .post-navigation -->
	<?php 
    }
开发者ID:justatechnology,项目名称:Security,代码行数:39,代码来源:template-tags.php

示例7: jose_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     */
    function jose_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;
        }
        ?>

	<?php 
        previous_post_link('<div class="item_nav nav-previous">%link</div>', _x('<span class="meta-nav"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="60" viewBox="0 0 60 60">
<g id="icomoon-ignore">
	<line stroke-width="1" x1="" y1="" x2="" y2="" stroke="#449FDB" opacity=""></line>
</g>
	<path d="M43.197 52.254c0.804 0.813 0.804 2.124 0 2.937s-2.103 0.813-2.907 0l-23.49-23.721c-0.804-0.813-0.804-2.127 0-2.937l23.49-23.724c0.804-0.813 2.103-0.813 2.907 0s0.804 2.124 0 2.937l-21.42 22.254 21.42 22.254z" class="blob"></path>
</svg></span>&nbsp;', 'Previous post link', 'jose'));
        next_post_link('<div class="item_nav nav-next">%link</div>', _x('&nbsp;<span class="meta-nav"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="60" viewBox="0 0 60 60">
<g id="icomoon-ignore">
	<line stroke-width="1" x1="" y1="" x2="" y2="" stroke="#449FDB" opacity=""></line>
</g>
	<path d="M16.799 52.254c-0.804 0.813-0.804 2.124 0 2.937s2.103 0.813 2.907 0l23.49-23.721c0.804-0.813 0.804-2.127 0-2.937l-23.49-23.724c-0.804-0.813-2.103-0.813-2.907 0s-0.804 2.124 0 2.937l21.42 22.254-21.42 22.254z" class="blob"></path>
</svg></span>', 'Next post link', 'jose'));
        ?>

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

示例8: cover_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function cover_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', 'cover');
        ?>
</h1>
		<div class="nav-links cf">
			<?php 
        if ($previous) {
            previous_post_link('<div class="nav-previous">%link</div>', _x('<h2 class="subtitle">' . __('Previous post', 'cover') . '</h2><h1 class="title">%title</h1>', 'Previous post link', 'cover'));
        }
        if ($next) {
            $next_img_array = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'single-post-thumbnail');
            $next_img = $next_img_array[0];
            $class = '';
            $style = '';
            if ('' != $next_img) {
                $class = ' featured-image';
                $style = ' style="background-image: url(\'' . $next_img . '\')"';
            }
            next_post_link('<div class="nav-next">%link</div>', _x('<div class="cover' . $class . '"><div class="cover-background"' . $style . '></div><div class="cover-header"><h2 class="cover-subtitle">' . __('Next post', 'cover') . '</h2><h1 class="cover-title">%title</h1></div></div>', 'Next post link', 'cover'));
        }
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
开发者ID:9x,项目名称:cover,代码行数:40,代码来源:template-tags.php

示例9: ct_tracks_further_reading

function ct_tracks_further_reading()
{
    global $post;
    // gets the next & previous posts if they exist
    $previous_blog_post = get_adjacent_post(false, '', true);
    $next_blog_post = get_adjacent_post(false, '', false);
    if (get_the_title($previous_blog_post)) {
        $previous_title = get_the_title($previous_blog_post);
    } else {
        $previous_title = "The Previous Post";
    }
    if (get_the_title($next_blog_post)) {
        $next_title = get_the_title($next_blog_post);
    } else {
        $next_title = "The Next Post";
    }
    echo "<nav class='further-reading'>";
    if ($previous_blog_post) {
        echo "<p class='prev'>\n        \t\t<span>Previous Post</span>\n        \t\t<a href='" . get_permalink($previous_blog_post) . "'>" . $previous_title . "</a>\n\t        </p>";
    } else {
        echo "<p class='prev'>\n                <span>This is the oldest post</span>\n        \t\t<a href='" . esc_url(home_url()) . "'>Return to Blog</a>\n        \t</p>";
    }
    if ($next_blog_post) {
        echo "<p class='next'>\n        \t\t<span>Next Post</span>\n        \t\t<a href='" . get_permalink($next_blog_post) . "'>" . $next_title . "</a>\n\t        </p>";
    } else {
        echo "<p class='next'>\n                <span>This is the newest post</span>\n        \t\t<a href='" . esc_url(home_url()) . "'>Return to Blog</a>\n        \t </p>";
    }
    echo "</nav>";
}
开发者ID:LdyNailih,项目名称:RespaldoServidor,代码行数:29,代码来源:deprecated.php

示例10: digistarter_post_nav

    /**
     * Display navigation to next/previous post when applicable.
     *
     * @return void
     */
    function digistarter_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">
		<h3 class="screen-reader-text">
		<?php 
        __('Post navigation', TRANSLATED_TEXT_DOMAIN);
        ?>
		</h3>
		<div class="nav-links">

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


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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: uncode_post_navigation

    /**
     * Display navigation to next/previous post when applicable.
     */
    function uncode_post_navigation($index_btn = '')
    {
        // 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;
        }
        $output = '<nav class="post-navigation" role="navigation">
									<ul class="navigation">';
        $prev = get_previous_post_link('<li class="page-prev"><span class="btn-container">%link</span></li>', '<i class="fa fa-angle-left"></i><span>' . esc_html__('Prev', 'uncode') . '</span>');
        if ($prev !== '') {
            $output .= $prev;
        } else {
            $output .= '<li class="page-prev"><span class="btn-container"><span class="btn btn-link btn-icon-left btn-disable-hover"><i class="fa fa-angle-left"></i>' . esc_html__('Prev', 'uncode') . '</span></span></li>';
        }
        if ($index_btn !== '') {
            $output .= '<li class="nav-back"><span class="btn-container">' . $index_btn . '</span></li>';
        }
        $next = get_next_post_link('<li class="page-next"><span class="btn-container">%link</span></li>', '<span>' . esc_html__('Next', 'uncode') . '</span><i class="fa fa-angle-right"></i>');
        if ($next !== '') {
            $output .= $next;
        } else {
            $output .= '<li class="page-next"><span class="btn-container"><span class="btn btn-link btn-icon-right btn-disable-hover">' . esc_html__('Next', 'uncode') . '<i class="fa fa-angle-right"></i></span></span></li>';
        }
        $output .= '</ul><!-- .navigation -->
							</nav><!-- .post-navigation -->';
        return $output;
    }
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:32,代码来源:template-tags.php


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