本文整理汇总了PHP中previous_posts_link函数的典型用法代码示例。如果您正苦于以下问题:PHP previous_posts_link函数的具体用法?PHP previous_posts_link怎么用?PHP previous_posts_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了previous_posts_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: woo_pagenav
function woo_pagenav($custom_query = '')
{
global $woo_options, $wp_query, $paged, $page;
// Set query max pages
$max_pages = 1;
if ('' != $custom_query) {
$max_pages = $custom_query->max_num_pages;
} else {
$max_pages = $wp_query->max_num_pages;
}
// If the user has set the option to use simple paging links, display those. By default, display the pagination.
if (@$woo_options['woo_pagination_type'] == 'simple') {
if (get_next_posts_link('', $max_pages) || get_previous_posts_link()) {
?>
<div class="nav-entries">
<?php
next_posts_link('<span class="nav-prev fl"><i class="icon-angle-left"></i> ' . __('Older posts', 'woothemes') . '</span>', $max_pages);
?>
<?php
previous_posts_link('<span class="nav-next fr">' . __('Newer posts', 'woothemes') . ' <i class="icon-angle-right"></i></span>');
?>
<div class="fix"></div>
</div>
<?php
}
// End IF Statement
} else {
woo_pagination(array(), $custom_query);
}
// End IF Statement
}
示例2: cleanblog_posts_navigation
/**
* Display navigation to next/previous set of posts when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function cleanblog_posts_navigation()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
?>
<ul class="pager">
<?php
if (get_next_posts_link()) {
?>
<li class="next"><?php
next_posts_link(esc_html__('Older posts', 'cleanblog'));
?>
</li>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<li class="previous"><?php
previous_posts_link(esc_html__('Newer posts', 'cleanblog'));
?>
</li>
<?php
}
?>
</ul>
<?php
}
示例3: twentyeleven_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function twentyeleven_content_nav($nav_id)
{
global $wp_query;
if ($wp_query->max_num_pages > 1) {
?>
<nav id="<?php
echo $nav_id;
?>
">
<h3 class="assistive-text"><?php
_e('Post navigation', 'twentyeleven');
?>
</h3>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'twentyeleven'));
?>
</div>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'twentyeleven'));
?>
</div>
</nav><!-- #nav-above -->
<?php
}
}
示例4: response_newer_posts
/**
* Sets up the next post link and applies a filter to the link text.
*
* @since 1.0
*/
function response_newer_posts()
{
$newer_text = apply_filters('response_newer_posts_text', 'Newer Entries »');
echo "<div class='pagprev-posts'>";
previous_posts_link(__($newer_text, 'response'));
echo "</div>";
}
示例5: cactusthemes_content_nav
/**
* Displays navigation to next/previous pages when applicable.
*
* @since Twenty Twelve 1.0
*/
function cactusthemes_content_nav($html_id, $custom_query = false)
{
global $wp_query;
$current_query = $wp_query;
if ($custom_query) {
$current_query = $custom_query;
}
$html_id = esc_attr($html_id);
if ($current_query->max_num_pages > 1) {
?>
<nav id="<?php
echo $html_id;
?>
" class="navigation" role="navigation">
<div class="nav-previous alignleft"><?php
next_posts_link(__('Older posts <span class="meta-nav">→</span>', 'cactusthemes'), $current_query->max_num_pages);
?>
</div>
<div class="nav-next alignright"><?php
previous_posts_link(__('<span class="meta-nav">←</span> Newer posts', 'cactusthemes'));
?>
</div>
</nav><!-- #<?php
echo $html_id;
?>
.navigation -->
<?php
}
}
示例6: sosimple_pagination
/**
* Print the previous and next links depending on the current template.
*/
function sosimple_pagination()
{
global $wp_query;
if (is_single()) {
?>
<nav class="nav single-nav" role="navigation">
<span class="home"><a href="<?php
echo esc_url(home_url('/'));
?>
"></a></span>
</nav>
<?php
} elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
?>
<nav class="nav paged-nav" role="navigation">
<span class="previous"><?php
previous_posts_link('');
?>
</span>
<span class="next"><?php
next_posts_link('');
?>
</span>
</nav>
<?php
}
}
示例7: zerif_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function zerif_paging_nav()
{
echo '<div class="clear"></div>';
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'zerif');
?>
</h1>
<div class="nav-links">
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'zerif'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'zerif'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
示例8: webonary_zeedisplay_page_navigation
/**
* Common page navigation
*/
function webonary_zeedisplay_page_navigation()
{
if (function_exists('wp_pagenavi')) {
// if PageNavi is activated
?>
<div class="more_posts">
<?php
wp_pagenavi();
// Use PageNavi
?>
</div>
<?php
} else {
// Otherwise, use traditional Navigation
?>
<div class="more_posts">
<span class="post_links">
<?php
previous_posts_link(__('« Previous Entries', ZEE_LANG));
?>
<?php
next_posts_link(__('Next Entries »', ZEE_LANG)) & nbsp;
?>
</span>
</div>
<?php
}
}
示例9: section_template
function section_template()
{
?>
<?php
if (function_exists('wp_pagenavi') && show_posts_nav() && VPRO) {
?>
<?php
wp_pagenavi();
?>
<?php
} elseif (show_posts_nav()) {
?>
<div class="page-nav-default fix">
<span class="previous-entries"><?php
next_posts_link(__('← Previous Entries', 'pagelines'));
?>
</span>
<span class="next-entries"><?php
previous_posts_link(__('Next Entries →', 'pagelines'));
?>
</span>
</div><!-- page nav -->
<?php
}
?>
<?php
}
示例10: orbit_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function orbit_content_nav($nav_id)
{
global $wp_query;
?>
<nav id="<?php
echo $nav_id;
?>
">
<ul>
<?php
if (is_single()) {
// navigation links for single posts
?>
<li><?php
previous_post_link('%link', '' . _x('←', 'Previous post link', 'orbit') . '%title');
?>
</li>
<li><?php
next_post_link('%link', '%title' . _x('→', 'Next post link', 'orbit') . '');
?>
</li>
<?php
} elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
// navigation links for home, archive, and search pages
?>
<?php
if (get_next_posts_link()) {
?>
<li><?php
next_posts_link(__('← Older posts', 'orbit'));
?>
</li>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<li><?php
previous_posts_link(__('Newer posts →', 'orbit'));
?>
</li>
<?php
}
?>
<?php
}
?>
</ul>
</nav><!-- #<?php
echo $nav_id;
?>
-->
<?php
}
示例11: comicpress_pagination
function comicpress_pagination()
{
global $post, $wp_query;
if (function_exists('wp_pagenavi')) {
?>
<?php
wp_pagenavi('<div id="wp-paginav">', '<div class="clear"></div></div>');
?>
<?php
} else {
?>
<div id="pagenav">
<div class="pagenav-right"><?php
previous_posts_link(__('Newer Entries ↑', 'comicpress'));
?>
</div>
<div class="pagenav-left"><?php
next_posts_link(__('↓ Previous Entries', 'comicpress'));
?>
</div>
<div class="clear"></div>
</div>
<?php
}
}
示例12: silencio_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @return void
*/
function silencio_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
?>
<nav class="navigation paging-navigation" role="navigation">
<div class="nav-links">
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'silencio'));
?>
</div>
<?php
}
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'silencio'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
示例13: cd_posts_navigation
/**
* Display navigation to next/previous set of posts when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function cd_posts_navigation()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
?>
<nav class="navigation posts-navigation" role="navigation">
<h2 class="screen-reader-text"><?php
_e('Posts navigation', 'codediva');
?>
</h2>
<div class="nav-links">
<div class="nav-previous"><?php
next_posts_link(__('← Older posts', 'underscores'));
?>
</div>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts →', 'underscores'));
?>
</div>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
示例14: teaberry_content_nav
/**
* displays navigation to next/previous pages when applicable.
*/
function teaberry_content_nav($html_id)
{
global $wp_query;
$html_id = esc_attr($html_id);
if ($wp_query->max_num_pages > 1) {
?>
<nav id="<?php
echo $html_id;
?>
" class="navigation" role="navigation">
<div class="nav-previous">
<?php
$text = __('<span class="meta-nav">←</span> Older posts', 'teaberry');
next_posts_link($text);
?>
</div>
<div class="nav-next">
<?php
$text = __('Newer posts <span class="meta-nav">→</span>', 'teaberry');
previous_posts_link($text);
?>
</div>
</nav><!-- #<?php
echo $html_id;
?>
.navigation -->
<?php
}
}
示例15: chivenewengland_content_nav
/**
* Displays navigation to next/previous pages when applicable.
*
* @since Twenty Twelve 1.0
*/
function chivenewengland_content_nav($html_id)
{
global $wp_query;
if ($wp_query->max_num_pages > 1) {
?>
<nav id="<?php
echo esc_attr($html_id);
?>
" class="navigation" role="navigation">
<ul class="pager">
<li class="previous">
<?php
next_posts_link(__('<i class="fa fa-chevron-left fa-fw"></i> Older', 'chivenewengland'));
?>
</li>
<li class="next">
<?php
previous_posts_link(__('Newer <i class="fa fa-chevron-right fa-fw"></i>', 'chivenewengland'));
?>
</li>
</ul>
</nav><!-- .navigation -->
<?php
}
}