本文整理汇总了PHP中get_previous_post_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_previous_post_link函数的具体用法?PHP get_previous_post_link怎么用?PHP get_previous_post_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_previous_post_link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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">←</span> %title', 'Previous post link', 'the-one'));
$_next_post_link = get_next_post_link('<div class="nav-next">%link</div>', _x('%title <span class="meta-nav">→</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
示例2: test_get_previous_post_link_exclude_category
public function test_get_previous_post_link_exclude_category()
{
$actual = get_previous_post_link('« %link', '%title', false, $this->cat_id);
$title = get_post($this->post_ids[3])->post_title;
$expected = '« <a href="' . home_url('?p=' . $this->post_ids[3]) . '" rel="prev">' . $title . '</a>';
$this->assertSame($expected, $actual);
}
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:7,代码来源:getAdjacentPostLink.php
示例3: 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
示例4: hsinsider_the_posts_navigation
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>';
}
}
开发者ID:jperezlatimes,项目名称:hsinsider,代码行数:8,代码来源:rewrites.php
示例5: presscore_get_previous_post_link
function presscore_get_previous_post_link($link_text = '', $link_class = '', $dummy = '')
{
$post_link = get_previous_post_link('%link', $link_text);
if ($post_link) {
return str_replace('href=', 'class="' . esc_attr($link_class) . '" href=', $post_link);
}
return $dummy;
}
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:8,代码来源:post-navigation.php
示例6: greybox_prev_post_link
function greybox_prev_post_link()
{
$gb_ppl = get_previous_post_link();
if (empty($gb_ppl)) {
echo '<p>You are reading the oldest post.</p>';
} else {
echo '<p>Read an older post:</p>';
previous_post_link();
}
}
开发者ID:kjodle,项目名称:Greybox,代码行数:10,代码来源:template-tags.php
示例7: flatbook_post_navigation
/**
* Custom post navigation function
*/
function flatbook_post_navigation()
{
$nav = '';
$prev = get_previous_post_link('<div class="pull-left">%link</div>', '← %title', true);
$next = get_next_post_link('<div class="pull-right">%link</div>', '%title →', true);
if ($prev || $next) {
$nav = _navigation_markup($prev . $next, 'post-navigation');
}
echo $nav;
}
开发者ID:de190909,项目名称:WPTest,代码行数:13,代码来源:template-tags.php
示例8: sensitive_skin_bootstrap_posts_navigation
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;
}
开发者ID:bmeisler,项目名称:ssm-bootstrap,代码行数:12,代码来源:template-tags.php
示例9: piedtheme_post_navigation
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;
}
开发者ID:abisz,项目名称:piedTheme,代码行数:16,代码来源:template-tags.php
示例10: get_the_post_navigation
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;
}
开发者ID:felixarntz,项目名称:wp-starter-theme,代码行数:17,代码来源:BootstrapContentNavigation.php
示例11: presscore_post_navigation
/**
* 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;
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:65,代码来源:helpers.php
示例12: the_field
?>
</div>
<div class="row content content-single">
<div class="col xs-12 md-10 offset-md-1 lg-8 offset-lg-2">
<?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
开发者ID:CharlieMCR,项目名称:Kaplan2,代码行数:31,代码来源:single.php
示例13: get_the_title
echo get_the_title();
?>
</h1>
</div>
<div id="article-content">
<?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">
开发者ID:JackBrit,项目名称:Team-London-Bridge,代码行数:31,代码来源:single-bak.php
示例14: the_title
<header class="header-title clearfix">
<?php
if (wpo_theme_options('post-title')) {
?>
<h2 class="entry-title pull-left">
<?php
the_title();
?>
</h2>
<?php
}
?>
<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> ');
开发者ID:jimmitjoo,项目名称:mnh,代码行数:31,代码来源:content-portfolio.php
示例15: sunset_post_navigation
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;
}
开发者ID:Alecaddd,项目名称:Sunset-theme,代码行数:10,代码来源:theme-support.php
示例16: beans_post_navigation
/**
* 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');
}
开发者ID:Getbeans,项目名称:Beans,代码行数:37,代码来源:post.php
示例17: wp_link_pages
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('« %link', '%title', 1) or get_previous_post_link('%link »', '%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('←', 'Previous feature', 'cuvey') . '</span> %title');
?>
</li>
<li class="next">
<?php
next_posts_link('%link', '%title <span class="meta-nav">' . _x('→', 'Next feature', 'cuvey') . '</span>');
?>
</li>
</ul>
</div>
开发者ID:rafinkarki,项目名称:Themes,代码行数:31,代码来源:article.php
示例18: get_the_post_navigation
/**
* 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;
}
开发者ID:gigikiri,项目名称:WordPress,代码行数:30,代码来源:link-template.php
示例19:
<div class="comments">
<?php
//comments_template();
?>
</div>
<?php
}
?>
<?php
if (!is_home()) {
?>
<!-- Footer navigation -->
<div id="nav-footer">
<?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())) {
?>
开发者ID:VanessaGarcia-Freelance,项目名称:CrowdsLine,代码行数:31,代码来源:index.php
示例20: get_next_post_link
<?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
}
开发者ID:fovoc,项目名称:make,代码行数:25,代码来源:nav-post.php
注:本文中的get_previous_post_link函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论