コード例 #1
1
/**
 * 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 
}
コード例 #2
0
    /**
     * 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;
    }
コード例 #3
0
 public function test_get_next_post_link_exclude_category()
 {
     $actual = get_next_post_link('%link &raquo;', '%title', false, $this->cat_id);
     $title = get_post($this->post_ids[1])->post_title;
     $expected = '<a href="' . home_url('?p=' . $this->post_ids[1]) . '" rel="next">' . $title . '</a> &raquo;';
     $this->assertSame($expected, $actual);
 }
コード例 #4
0
 function presscore_get_next_post_link($link_text = '', $link_class = '', $dummy = '')
 {
     $post_link = get_next_post_link('%link', $link_text);
     if ($post_link) {
         return str_replace('href=', 'class="' . esc_attr($link_class) . '" href=', $post_link);
     }
     return $dummy;
 }
コード例 #5
0
ファイル: rewrites.php プロジェクト: jperezlatimes/hsinsider
function hsinsider_the_posts_navigation()
{
    if (!is_single()) {
        echo '<nav class="navigation post-navigation" role="navigation"><div class="nav-previous alignleft">' . get_next_posts_link('<i class="LATArrowLeft01"></i>Older Articles') . '</div><div class="nav-next alignright">' . get_previous_posts_link('Newer Articles<i class="LATArrowRight01"></i>') . '</div></nav>';
    } else {
        echo '<nav class="navigation post-navigation" role="navigation"><div class="nav-previous alignleft">' . get_previous_post_link('%link', '<i class="LATArrowLeft01"></i>%title') . '</div><div class="nav-next alignright">' . get_next_post_link('%link', '%title<i class="LATArrowRight01"></i>') . '</div></nav>';
    }
}
コード例 #6
0
ファイル: template-tags.php プロジェクト: kjodle/Greybox
function greybox_next_post_link()
{
    $gb_npl = get_next_post_link();
    if (empty($gb_npl)) {
        echo '<p>You are reading the newest post.</p>';
    } else {
        echo '<p>Read a newer post:</p>';
        next_post_link();
    }
}
コード例 #7
0
 function sensitive_skin_bootstrap_posts_navigation($args = array())
 {
     $args = wp_parse_args($args, array('prev_text' => '%title', 'next_text' => '%title', 'screen_reader_text' => __('Post navigation')));
     $navigation = '';
     $previous = get_previous_post_link('<div class="nav-previous">%link</div>', $args['prev_text']);
     $next = get_next_post_link('<div class="nav-next">%link</div>', $args['next_text']);
     // Only add markup if there's somewhere to navigate to.
     if ($previous || $next) {
         $navigation = _navigation_markup($previous . $next, 'post-navigation', $args['screen_reader_text']);
     }
     return $navigation;
 }
コード例 #8
0
ファイル: template-tags.php プロジェクト: abisz/piedTheme
function piedtheme_post_navigation($args = array())
{
    $args = wp_parse_args($args, array('prev_text' => '%title', 'next_text' => '%title', 'screen_reader_text' => __('Post navigation')));
    $navigation = '';
    $previousArrow = get_previous_post_link('<div class="arrow-previous">%link</div>', '<i class="fa fa-backward nav"></i>');
    $previous = get_previous_post_link('<div class="navtext">%link</div>', '<p>' . $args['prev_text'] . '</p>');
    $nextArrow = get_next_post_link('<div class="arrow-next">%link</div>', '<i class="fa fa-forward nav"></i>');
    $next = get_next_post_link('<div class="navtext">%link</div>', '<p>' . $args['next_text'] . '</p>');
    // Only add markup if there's somewhere to navigate to.
    /*
        if ( $previous || $next ) {
            $navigation = _navigation_markup( $previous . $next, 'post-navigation', $args['screen_reader_text'] );
        }*/
    $navigation = "<nav class='navigation post-navigation' role='navigation'>\n\t\t<h2 class='screen-reader-text'>Posts navigation</h2>\n\t\t<div class='nav-links clear'>\n\t\t<div class='nav-previous'>" . $previousArrow . $previous . "</div><div class='nav-next'>" . $nextArrow . $next . "</div></div>\n\t</nav>";
    echo $navigation;
}
コード例 #9
0
 public static function get_the_post_navigation($args = array())
 {
     $args = wp_parse_args($args, array('prev_text' => '%title', 'next_text' => '%title', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category', 'screen_reader_text' => __('Post navigation', 'wp-starter-theme'), 'aligned' => false));
     $navigation = '';
     $prev_template = $next_template = '<li>%link</li>';
     if ($args['aligned']) {
         $prev_template = str_replace('<li>', '<li class="pager-prev">', $prev_template);
         $next_template = str_replace('<li>', '<li class="pager-next">', $next_template);
     }
     $prev_link = get_previous_post_link($prev_template, $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy']);
     $next_link = get_next_post_link($next_template, $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy']);
     if ($prev_link || $next_link) {
         $navigation = '<ul class="pager">' . $prev_link . $next_link . '</ul>';
         $navigation = _navigation_markup($navigation, 'post-navigation', $args['screen_reader_text']);
     }
     return $navigation;
 }
コード例 #10
0
ファイル: helpers.php プロジェクト: scottnkerr/eeco
 /**
  * Next/previous post buttons helper.
  *
  * Works only in the loop. Sample options array:
  * array(
  *		'wrap'				=> '<div class="paginator-r inner-navig">%LINKS%</div>',
  *		'title_wrap'		=> '<span class="pagin-info">%TITLE%</span>',
  *		'no_link_next'		=> '<a href="#" class="prev no-act" onclick="return false;"></a>',
  *		'no_link_prev'		=> '<a href="#" class="next no-act" onclick="return false;"></a>',
  *		'title'				=> 'Post %CURRENT% of %MAX%',
  *		'next_post_class'	=> 'prev',
  *		'prev_post_class'	=> 'next',
  *		 next_post_text'	=> '',
  *		'prev_post_text'	=> '',
  *		'echo'				=> true
  * )
  *
  * @param array $args Options array.
  * @since presscore 1.0
  */
 function presscore_post_navigation($args = array())
 {
     global $wpdb, $post;
     if (!in_the_loop()) {
         return false;
     }
     $next_post_text = _x('Prev', 'post nav', LANGUAGE_ZONE);
     $prev_post_text = _x('Next', 'post nav', LANGUAGE_ZONE);
     $defaults = array('wrap' => '<div class="navigation-inner">%LINKS%</div>', 'title_wrap' => '', 'no_link_next' => '<a class="prev-post disabled" href="javascript: void(0);">' . $next_post_text . '</a>', 'no_link_prev' => '<a class="next-post disabled" href="javascript: void(0);">' . $prev_post_text . '</a>', 'title' => '', 'next_post_class' => 'prev-post', 'prev_post_class' => 'next-post', 'next_post_text' => $next_post_text, 'prev_post_text' => $prev_post_text, 'echo' => true);
     $args = apply_filters('presscore_post_navigation-args', wp_parse_args($args, $defaults));
     $args = wp_parse_args($args, $defaults);
     $title = $args['title'];
     if (false !== strpos($title, '%CURRENT%') || false !== strpos($title, '%MAX%')) {
         $posts = new WP_Query(array('no_found_rows' => true, 'fields' => 'ids', 'posts_per_page' => -1, 'post_type' => get_post_type(), 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC'));
         $current = 1;
         foreach ($posts->posts as $index => $post_id) {
             if ($post_id == get_the_ID()) {
                 $current = $index + 1;
                 break;
             }
         }
         $title = str_replace(array('%CURRENT%', '%MAX%'), array($current, count($posts->posts)), $title);
     }
     $output = '';
     $output .= str_replace(array('%TITLE%'), array($title), $args['title_wrap']);
     // next link
     $next_post_link = get_next_post_link('%link', $args['next_post_text']);
     if ($next_post_link) {
         $next_post_link = str_replace('href=', 'class="' . $args['next_post_class'] . '" href=', $next_post_link);
     } else {
         $next_post_link = $args['no_link_next'];
     }
     // previos link
     $previous_post_link = get_previous_post_link('%link', $args['prev_post_text']);
     if ($previous_post_link) {
         $previous_post_link = str_replace('href=', 'class="' . $args['prev_post_class'] . '" href=', $previous_post_link);
     } else {
         $previous_post_link = $args['no_link_prev'];
     }
     $output = str_replace(array('%LINKS%', '%NEXT_POST_LINK%', '%PREV_POST_LINK%'), array($next_post_link . $previous_post_link, $next_post_link, $previous_post_link), $args['wrap']);
     if ($args['echo']) {
         echo $output;
     }
     return $output;
 }
コード例 #11
0
			<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        the_content();
        $prev = get_adjacent_post(false, '', false);
        $next = get_adjacent_post(false, '', true);
        if (empty($next)) {
            $nextlink = '';
        } else {
            $nextlink = get_previous_post_link('%link', '<li class="rs-right"></li>');
        }
        if (empty($prev)) {
            $prevlink = '';
        } else {
            $prevlink = get_next_post_link('%link', '<li class="rs-left"></li>');
        }
    }
}
?>
		</div>
       <?php 
$posts = get_field('related_latest_posts');
if ($posts) {
    ?>
		<div id="mightlike">
			<div id="mightlike-title"><img src="<?php 
    echo get_template_directory_uri();
    ?>
/images/youmight-green.png"></div>
			<div id="mightlike-thumbs">
コード例 #12
0
function sunset_post_navigation()
{
    $nav = '<div class="row">';
    $prev = get_previous_post_link('<div class="post-link-nav"><span class="sunset-icon sunset-chevron-left" aria-hidden="true"></span> %link</div>', '%title');
    $nav .= '<div class="col-xs-12 col-sm-6">' . $prev . '</div>';
    $next = get_next_post_link('<div class="post-link-nav">%link <span class="sunset-icon sunset-chevron-right" aria-hidden="true"></span></div>', '%title');
    $nav .= '<div class="col-xs-12 col-sm-6 text-right">' . $next . '</div>';
    $nav .= '</div>';
    return $nav;
}
コード例 #13
0
ファイル: single.php プロジェクト: CharlieMCR/Kaplan2
			<?php 
the_field('description');
?>
				
		<div class="row project-links">
			<ul class="clearfix <?php 
echo get_previous_post_link('%link') ? "" : "left";
echo get_next_post_link('%link') ? "" : "right";
?>
">
				<?php 
echo get_previous_post_link('%link') ? '<li class="prev">' . get_previous_post_link("%link") . '</li>' : "";
?>
				<!-- <li class="pipe">|</li> -->
				<?php 
echo get_next_post_link('%link') ? '<li class="next">' . get_next_post_link("%link") . '</li>' : "";
?>
			</ul>
		</div>
			</div>
		</div>


	</div>
</div>
<script>
	var imageHeight = <?php 
echo $imageHeight;
?>
,
		imageWidth = <?php 
コード例 #14
0
ファイル: article.php プロジェクト: rafinkarki/Themes
    wp_link_pages(array('next_or_number' => 'number', 'nextpagelink' => __('Next page', 'cuvey'), 'previouspagelink' => __('Previous page', 'cuvey'), 'pagelink' => '%', 'link_before' => '<span class="ft-btn">', 'link_after' => '</span>', 'before' => '<div class="clearfix"></div>' . __('Pages:', 'cuvey') . ' <div class="ft-article-pages">', 'after' => '</div>'));
    ?>

    </div><!-- end blog -->
    <div class="clearfix"></div>
    <hr>
<?php 
}
?>





<?php 
if (get_next_post_link('&laquo; %link', '%title', 1) or get_previous_post_link('%link &raquo;', '%title', 1)) {
    ?>
    <div class="prev-next-btn" style="display:none;">
      <ul class="pager">
        <li class="previous">
        <?php 
    previous_posts_link('%link', '<span class="meta-nav">' . _x('&larr;', 'Previous feature', 'cuvey') . '</span> %title');
    ?>
        </li>
        <li class="next">
        <?php 
    next_posts_link('%link', '%title <span class="meta-nav">' . _x('&rarr;', 'Next feature', 'cuvey') . '</span>');
    ?>
        </li>
      </ul>
    </div>
コード例 #15
0
ファイル: content-portfolio.php プロジェクト: jimmitjoo/mnh
?>

			<div class="pull-right">
			    <?php 
if (get_previous_post_link() != '') {
    ?>
			    <div class="btn btn-link">
			        <?php 
    previous_post_link('%link', ' <i class="fa fa-angle-left"></i> Previous');
    ?>
			    </div>
			    <?php 
}
?>
			    <?php 
if (get_next_post_link() != '') {
    ?>
			    <div class="btn btn-link">
			        <?php 
    next_post_link('%link', 'Next <i class="fa fa-angle-right"></i> ');
    ?>
			    </div>
			    <?php 
}
?>
			</div>
		</header><!-- /header -->

		<div class="entry-thumb">
			<?php 
if (has_post_format('video')) {
コード例 #16
0
							<?php 
        if (!($link = get_previous_post_link())) {
            ?>
							<?php 
        } else {
            ?>
							<div class="post-nav-left button normal clearfix">
							<?php 
            previous_post_link('%link', 'Next');
            ?>
							</div>
							<?php 
        }
        ?>
							<?php 
        if (!($link = get_next_post_link())) {
            ?>
							<?php 
        } else {
            ?>
							<div class="post-nav-right button normal clearfix">
							<?php 
            next_post_link('%link', 'Prev');
            ?>
							</div>
							<?php 
        }
        ?>
						</div>
					<?php 
    }
コード例 #17
0
ファイル: post.php プロジェクト: Getbeans/Beans
/**
 * Echo post navigation.
 *
 * @since 1.0.0
 */
function beans_post_navigation()
{
    /**
     * Filter whether {@see beans_post_navigation()} should be short-circuit or not.
     *
     * @since 1.0.0
     *
     * @param bool $pre True to short-circuit, False to let the function run.
     */
    if (apply_filters('beans_pre_post_navigation', !is_singular('post'))) {
        return;
    }
    $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
    $next = get_adjacent_post(false, '', false);
    if (!$next && !$previous) {
        return;
    }
    beans_open_markup_e('beans_post_navigation', 'ul', array('class' => 'uk-pagination', 'role' => 'navigation'));
    if ($previous) {
        // Previous.
        beans_open_markup_e('beans_post_navigation_item[_previous]', 'li', array('class' => 'uk-pagination-previous'));
        echo get_previous_post_link('%link', __('Previous', 'tm-beans'));
        beans_close_markup_e('beans_post_navigation_item[_previous]', 'li');
    }
    if ($next) {
        // Next.
        beans_open_markup_e('beans_post_navigation_item[_next]', 'li', array('class' => 'uk-pagination-next'));
        echo get_next_post_link('%link', __('Next', 'tm-beans'));
        beans_close_markup_e('beans_post_navigation_item[_next]', 'li');
    }
    beans_close_markup_e('beans_post_navigation', 'ul');
}
コード例 #18
0
ファイル: link-template.php プロジェクト: gigikiri/WordPress
/**
 * Return navigation to next/previous post when applicable.
 *
 * @since 4.1.0
 * @since 4.4.0 Introduced the `in_same_term`, `excluded_terms`, and `taxonomy` arguments.
 *
 * @param array $args {
 *     Optional. Default post navigation arguments. Default empty array.
 *
 *     @type string       $prev_text          Anchor text to display in the previous post link. Default '%title'.
 *     @type string       $next_text          Anchor text to display in the next post link. Default '%title'.
 *     @type bool         $in_same_term       Whether link should be in a same taxonomy term. Default false.
 *     @type array|string $excluded_terms     Array or comma-separated list of excluded term IDs. Default empty.
 *     @type string       $taxonomy           Taxonomy, if `$in_same_term` is true. Default 'category'.
 *     @type string       $screen_reader_text Screen reader text for nav element. Default 'Post navigation'.
 * }
 * @return string Markup for post links.
 */
function get_the_post_navigation($args = array())
{
    $args = wp_parse_args($args, array('prev_text' => '%title', 'next_text' => '%title', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category', 'screen_reader_text' => __('Post navigation')));
    $navigation = '';
    $previous = get_previous_post_link('<div class="nav-previous">%link</div>', $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy']);
    $next = get_next_post_link('<div class="nav-next">%link</div>', $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy']);
    // Only add markup if there's somewhere to navigate to.
    if ($previous || $next) {
        $navigation = _navigation_markup($previous . $next, 'post-navigation', $args['screen_reader_text']);
    }
    return $navigation;
}
コード例 #19
0
function barcelona_page_nav($query = FALSE)
{
    if (!$query) {
        global $wp_query;
        $query = $wp_query;
    }
    $barcelona_output = '';
    $barcelona_post_type = get_post_type();
    if (is_home() || is_archive() || is_search()) {
        if ($query->max_num_pages > 1) {
            $barcelona_output = paginate_links(array('base' => str_replace(99999, '%#%', esc_url(get_pagenum_link(99999))), 'format' => '', 'current' => max(1, get_query_var('paged')), 'total' => $query->max_num_pages, 'prev_text' => esc_html__('&laquo; Prev', 'barcelona'), 'next_text' => esc_html__('Next &raquo;', 'barcelona')));
            $barcelona_output = '<div class="pagination">' . $barcelona_output . '</div>';
        }
    } else {
        if (is_single() && $barcelona_post_type == 'post' && barcelona_get_option('show_post_nav') == 'on') {
            $barcelona_prev = get_previous_post_link('%link', '<span class="fa fa-angle-left"></span> %title');
            $barcelona_next = get_next_post_link('%link', '<span class="fa fa-angle-right"></span> %title');
            if (!is_null($barcelona_prev) || !is_null($barcelona_next)) {
                ?>

			<div class="row posts-nav">

				<div class="col col-xs-6">
					<?php 
                echo $barcelona_prev;
                ?>
				</div>

				<div class="col col-xs-6">
					<?php 
                echo $barcelona_next;
                ?>
				</div>

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

		<?php 
            }
        }
    }
    echo $barcelona_output;
}
コード例 #20
0
ファイル: single.php プロジェクト: bbronswijk/sensationred
						
						<div class="blog_title"><h1><?php 
        the_title();
        ?>
</h1></div>
						<p class="blog_date">  <?php 
        _e('Published on: ', 'sensationred');
        the_date();
        ?>
</p>
						<?php 
        the_content();
        ?>
						<div class="page_navigation">
							<?php 
        if (get_next_post_link('%link', '%title', true)) {
            ?>
								<?php 
            next_post_link('<div class="next_post_button">%link</div>', __('&larr; to next post', 'sensationred'), true);
            ?>
								<div class="next_blog_link"><?php 
            next_post_link('%link', '%title', true);
            ?>
</div>						
							<?php 
        }
        if (get_previous_post_link('%link', '%title', true)) {
            ?>
								<?php 
            previous_post_link('<div class="previous_post_button">%link</div>', __('to previous post &rarr;', 'sensationred'), TRUE);
            ?>
コード例 #21
0
ファイル: functions.php プロジェクト: khiconit/makeclean
    function makeclean_theme_pagination()
    {
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return '';
        }
        ?>
        <nav id="pagination" role="navigation">
            <?php 
        if (get_next_post_link()) {
            ?>
            <div class="prev">  <?php 
            next_posts_link(__('Older Posts', KC_DOMAIN));
            ?>
 </div>
            <?php 
        }
        ?>
            <?php 
        if (get_previous_posts_link()) {
            ?>

        <div class="next"> <?php 
            previous_posts_link(__('Newest Post', KC_DOMAIN));
            ?>
</div>
            <?php 
        }
        ?>

        </nav>

        <?php 
    }
コード例 #22
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $in_same_term = $this->shortcode_atts['in_same_term'];
        $taxonomy_name = $this->shortcode_atts['taxonomy_name'];
        $hide_prev = $this->shortcode_atts['hide_prev'];
        $hide_next = $this->shortcode_atts['hide_next'];
        $prev_text = $this->shortcode_atts['prev_text'];
        $next_text = $this->shortcode_atts['next_text'];
        // do not output anything if both prev and next links are disabled
        if ('on' === $hide_prev && 'on' === $hide_next) {
            return;
        }
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        $previous_link_text = '' !== $prev_text ? esc_html($prev_text) : '%title';
        $next_link_text = '' !== $next_text ? esc_html($next_text) : '%title';
        $in_same_term = 'on' === $in_same_term && !is_page() ? true : false;
        if ('' === $taxonomy_name) {
            $current_taxonomy = is_singular('project') ? 'project_category' : 'category';
        } else {
            $current_taxonomy = sanitize_text_field($taxonomy_name);
        }
        ob_start();
        $previous_post_link = get_previous_post_link('%link', '<span class="meta-nav">' . esc_html(_x('&larr;', 'Previous post link', 'et_builder')) . '</span> ' . $previous_link_text, $in_same_term, '', $current_taxonomy);
        $next_post_link = get_next_post_link('%link', $next_link_text . ' <span class="meta-nav">' . esc_html(_x('&rarr;', 'Next post link', 'et_builder')) . '</span>', $in_same_term, '', $current_taxonomy);
        if ('on' !== $hide_prev && '' !== $previous_post_link) {
            ?>
			<span class="nav-previous">
				<?php 
            echo $previous_post_link;
            ?>
			</span>
		<?php 
        }
        if ('on' !== $hide_next && '' !== $next_post_link) {
            ?>
			<span class="nav-next">
				<?php 
            echo $next_post_link;
            ?>
			</span>
		<?php 
        }
        $page_links = ob_get_contents();
        ob_end_clean();
        $output = sprintf('<div class="et_pb_posts_nav et_pb_module nav-single%2$s"%1$s>
				%3$s
			</div>', '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr(ltrim($module_class))) : '', $page_links);
        return $output;
    }
コード例 #23
0
ファイル: functions.php プロジェクト: otkinsey/wp-nsds
function camp_post_navigation()
{
    if (get_previous_posts_link()) {
        echo '<div class = "camp-prev-post-link" >';
        previous_posts_link(__('Newer posts &rarr;', 'camp'));
        echo '</div>';
    }
    if (get_next_posts_link()) {
        echo '<div class = "camp-next-post-link" >';
        next_posts_link(__('&larr; Older posts', 'camp'));
        echo '</div>';
    }
    if (is_single()) {
        if (get_previous_post_link()) {
            echo '<div class = "camp-prev-post-link" >';
            previous_post_link('%link', __('Next post &rarr;', 'camp'));
            echo '</div>';
        }
        if (get_next_post_link()) {
            echo '<div class = "camp-next-post-link" >';
            next_post_link('%link', __('&larr; Previous post', 'camp'));
            echo '</div>';
        }
    }
}
コード例 #24
0
ファイル: setup.php プロジェクト: jonstonnguyen/auberge
 function wm_post_nav()
 {
     //Requirements check
     if (!is_singular() || is_page()) {
         return;
     }
     //Helper variables
     $output = $prev_class = $next_class = '';
     $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
     $next = get_adjacent_post(false, '', false);
     //Requirements check
     if (!$next && !$previous || is_attachment() && 'attachment' == $previous->post_type) {
         return;
     }
     //Preparing output
     if ($previous && has_post_thumbnail($previous->ID)) {
         $prev_class = " has-post-thumbnail";
     }
     if ($next && has_post_thumbnail($next->ID)) {
         $next_class = " has-post-thumbnail";
     }
     if (is_attachment()) {
         $output .= get_previous_post_link('<div class="nav-previous' . $prev_class . '">%link</div>', __('<span class="meta-nav">Published In</span> <span class="post-title">%title</span>', 'wm_domain'));
     } else {
         $output .= get_previous_post_link('<div class="nav-previous' . $prev_class . '">%link</div>', __('<span class="meta-nav">Previous</span> <span class="post-title">%title</span>', 'wm_domain'));
         $output .= get_next_post_link('<div class="nav-next' . $next_class . '">%link</div>', __('<span class="meta-nav">Next</span> <span class="post-title">%title</span>', 'wm_domain'));
     }
     if ($output) {
         $output = '<nav class="navigation post-navigation" role="navigation"><h1 class="screen-reader-text">' . __('Post navigation', 'wm_domain') . '</h1><div class="nav-links">' . $output . '</div></nav>';
     }
     //Output
     echo apply_filters('wmhook_wm_post_nav_output', $output);
 }
コード例 #25
0
/**
 * Display next post link that is adjacent to the current post.
 *
 * @since 1.5.0
 * @see get_next_post_link()
 *
 * @param string       $format         Optional. Link anchor format.
 * @param string       $link           Optional. Link permalink format.
 * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
 * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
 * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
 */
function next_post_link($format = '%link &raquo;', $link = '%title', $in_same_cat = false, $excluded_terms = '', $taxonomy = 'category')
{
    echo get_next_post_link($format, $link, $in_same_cat, $excluded_terms, $taxonomy);
}
コード例 #26
0
ファイル: single.php プロジェクト: HardeepAsrani/photos
						<?php 
    if (get_previous_post_link() || get_next_post_link()) {
        ?>
							<ul class="pager">
							<?php 
        if (get_previous_post_link()) {
            ?>
								<li class="previous"><?php 
            previous_post_link('%link', __('&larr; Previous', 'photos'));
            ?>
</li>
							<?php 
        }
        ?>
							<?php 
        if (get_next_post_link()) {
            ?>
								<li class="next"><?php 
            next_post_link('%link', __('Next &rarr;', 'photos'));
            ?>
</li>
							<?php 
        }
        ?>
							</ul>
						<?php 
    }
    ?>
						<?php 
    if (comments_open() || get_comments_number()) {
        comments_template();
コード例 #27
0
ファイル: functions.php プロジェクト: mysia84/mnassalska
function dh_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="post-navigation" role="navigation">
		<div class="row">
			<?php 
    $prev_link = get_previous_post_link('%link', _x('%title', 'Previous post link', DH_DOMAIN));
    ?>
			<div class="col-sm-6">
			<?php 
    if ($prev_link) {
        ?>
				<div class="prev-post">
					<span>
					<?php 
        echo __('Previous article', DH_DOMAIN);
        ?>
					</span>
					<?php 
        echo dhecho($prev_link);
        ?>
				</div>
			<?php 
    }
    ?>
			</div>
			<?php 
    $next_link = get_next_post_link('%link', _x('%title', 'Next post link', DH_DOMAIN));
    ?>
			<div class="col-sm-6">
			<?php 
    if (!empty($next_link)) {
        ?>
				<div class="next-post">
					<span>
						<?php 
        echo __('Next article', DH_DOMAIN);
        ?>
					</span>
					<?php 
        echo dhecho($next_link);
        ?>
				</div>
			<?php 
    }
    ?>
			</div>
		</div>
	</nav>
	<?php 
}
コード例 #28
0
ファイル: functions.php プロジェクト: phongvan212/tuanh
    function thachpham_pagination()
    {
        /*
         * Không hiển thị phân trang nếu trang đó có ít hơn 2 trang
         */
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return '';
        }
        ?>
 
  <nav class="pagination" role="navigation">
    <?php 
        if (get_next_post_link()) {
            ?>
      <div class="prev"><?php 
            next_posts_link(__('Older Posts', 'thachpham'));
            ?>
</div>
    <?php 
        }
        ?>
 
    <?php 
        if (get_previous_post_link()) {
            ?>
      <div class="next"><?php 
            previous_posts_link(__('Newer Posts', 'thachpham'));
            ?>
</div>
    <?php 
        }
        ?>
 
  </nav><?php 
    }
コード例 #29
0
ファイル: nav-post.php プロジェクト: fovoc/make
<?php

/**
 * @package Make
 */
// Left arrow
$previous_link = get_next_post_link('<div class="nav-previous">%link</div>', '%title');
// Right arrow
$next_link = get_previous_post_link('<div class="nav-next">%link</div>', '%title');
if ('' !== $next_link || '' !== $previous_link) {
    ?>
<nav class="navigation post-navigation" role="navigation">
	<span class="screen-reader-text"><?php 
    esc_html_e('Post navigation', 'make');
    ?>
</span>
	<div class="nav-links">
		<?php 
    echo $previous_link;
    echo $next_link;
    ?>
	</div>
</nav>
<?php 
}
コード例 #30
0
function get_json($_post)
{
    foreach ($_post as $post) {
        $_post['post_class'] = implode(' ', get_post_class('', $_post['ID']));
        // Get next and previous links
        global $post;
        $post = get_post($_post['ID']);
        ob_start();
        echo get_next_post_link();
        $next_post_link = ob_get_contents();
        ob_end_clean();
        $next_post_link = str_replace('rel="next">', 'rel="next"><span class="screen-reader-text">', $next_post_link);
        $next_post_link = str_replace('</a> &raquo;', '</span></a>', $next_post_link);
        ob_start();
        echo get_previous_post_link();
        $previous_post_link = ob_get_contents();
        ob_end_clean();
        $previous_post_link = str_replace('rel="prev">', 'rel="prev"><span class="screen-reader-text">', $previous_post_link);
        $previous_post_link = str_replace('</a>', '</span></a>', $previous_post_link);
        $previous_post_link = str_replace('&laquo; ', '', $previous_post_link);
        $_post['next_post'] = $next_post_link;
        $_post['previous_post'] = $previous_post_link;
    }
    return $_post;
}