本文整理汇总了PHP中wp_page_numbers函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_page_numbers函数的具体用法?PHP wp_page_numbers怎么用?PHP wp_page_numbers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_page_numbers函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catchbox_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function catchbox_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', 'catchbox' ); ?></h3>
<?php if ( function_exists('wp_pagenavi' ) ) {
wp_pagenavi();
}
elseif ( function_exists('wp_page_numbers' ) ) {
wp_page_numbers();
}
else { ?>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'catchbox' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'catchbox' ) ); ?></div>
<?php
} ?>
</nav><!-- #nav -->
<?php
}
}
示例2: theme_page_navigation
function theme_page_navigation($args = '')
{
$args = wp_parse_args($args, array('wrap' => true, 'prev_link' => false, 'next_link' => false));
$prev_link = $args['prev_link'];
$next_link = $args['next_link'];
$wrap = $args['wrap'];
if (!$prev_link && !$next_link) {
if (function_exists('wp_page_numbers')) {
// http://wordpress.org/extend/plugins/wp-page-numbers/
ob_start();
wp_page_numbers();
theme_post_wrapper(array('content' => ob_get_clean()));
return;
}
if (function_exists('wp_pagenavi')) {
// http://wordpress.org/extend/plugins/wp-pagenavi/
ob_start();
wp_pagenavi();
theme_post_wrapper(array('content' => ob_get_clean()));
return;
}
//posts
$prev_link = get_previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', THEME_NS));
$next_link = get_next_posts_link(__('<span class="meta-nav">←</span> Older posts', THEME_NS));
}
$content = '';
if ($prev_link || $next_link) {
$content = <<<EOL
\t<div class="navigation">
\t\t<div class="alignleft">{$next_link}</div>
\t\t<div class="alignright">{$prev_link}</div>
\t </div>
EOL;
}
if ($wrap) {
theme_post_wrapper(array('content' => $content));
} else {
echo $content;
}
}
示例3: wp_tag_cloud
<?php
wp_tag_cloud('smallest=9&largest=22&unit=pt&number=200&format=flat&orderby=name&order=ASC');
?>
</div>
</div>
<?php
}
?>
<?php
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1) {
if (function_exists('wp_page_numbers')) {
wp_page_numbers();
} elseif (function_exists('wp_pagenavi')) {
wp_pagenavi();
} else {
echo '<div id="pagination">';
posts_nav_link(' ', __('<span class="pagination_prev">« Previous page</span>', 'simplelove'), __('<span class="pagination_next">Next page »</span>', 'simplelove'));
echo '</div>';
}
} else {
echo '<div id="pagination" class="pagination">';
echo '<a href="/">' . __('Home', 'simplelove') . '</a>';
echo '</div>';
}
?>
</div>
示例4: catchevolution_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function catchevolution_content_nav($nav_id)
{
global $wp_query;
/**
* Check Jetpack Infinite Scroll
* if it's active then disable pagination
*/
if (class_exists('Jetpack', false)) {
$jetpack_active_modules = get_option('jetpack_active_modules');
if ($jetpack_active_modules && in_array('infinite-scroll', $jetpack_active_modules)) {
return false;
}
}
$nav_class = 'site-navigation paging-navigation';
if (is_single()) {
$nav_class = 'site-navigation post-navigation';
}
if ($wp_query->max_num_pages > 1) {
?>
<nav role="navigation" id="<?php
echo $nav_id;
?>
">
<h3 class="assistive-text"><?php
_e('Post navigation', 'catch-evolution');
?>
</h3>
<?php
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
} elseif (function_exists('wp_page_numbers')) {
wp_page_numbers();
} else {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'catch-evolution'));
?>
</div>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'catch-evolution'));
?>
</div>
<?php
}
?>
</nav><!-- #nav -->
<?php
}
}
示例5: widget_navigation_bottom
function widget_navigation_bottom($args)
{
if (is_single() || is_page()) {
return;
}
?>
<div id="nav-below" class="navigation">
<?php
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
} elseif (function_exists('wp_page_numbers')) {
wp_page_numbers();
} else {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'thematic'));
?>
</div>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'thematic'));
?>
</div>
<?php
}
?>
</div>
<?php
}
示例6: simplecatch_content_nav
/**
* Display navigation to next/previous pages when applicable
*
* @since Catch Everest 1.0
*/
function simplecatch_content_nav($nav_id)
{
global $wp_query, $post;
/**
* Check Jetpack Infinite Scroll
* if it's active then disable pagination
*/
if (class_exists('Jetpack', false)) {
$jetpack_active_modules = get_option('jetpack_active_modules');
if ($jetpack_active_modules && in_array('infinite-scroll', $jetpack_active_modules)) {
return false;
}
}
// Checking WP Page Numbers plugin exist
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
// Checking WP-PageNaviplugin exist
} elseif (function_exists('wp_page_numbers')) {
wp_page_numbers();
} else {
if ($wp_query->max_num_pages > 1) {
?>
<ul class="default-wp-page">
<li class="previous"><?php
next_posts_link(__('Previous', 'simple-catch'));
?>
</li>
<li class="next"><?php
previous_posts_link(__('Next', 'simple-catch'));
?>
</li>
</ul>
<?php
}
}
}
示例7: catchkathmandu_content_query_nav
/**
* Display navigation to next/previous pages for custom query
*
* @since Catch Kathmandu 1.0
*/
function catchkathmandu_content_query_nav($nav_id)
{
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if (is_single()) {
$previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
$next = get_adjacent_post(false, '', false);
if (!$next && !$previous) {
return;
}
}
// Don't print empty markup in archives if there's only one page.
if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
return;
}
$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', 'catch-kathmandu');
?>
</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('←', 'Previous post link', 'catch-kathmandu') . '</span> %title');
?>
<?php
next_post_link('<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x('→', 'Next post link', 'catch-kathmandu') . '</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 (function_exists('wp_pagenavi')) {
wp_pagenavi();
} elseif (function_exists('wp_page_numbers')) {
wp_page_numbers();
} else {
?>
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'catch-kathmandu'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'catch-kathmandu'));
?>
</div>
<?php
}
?>
<?php
}
?>
<?php
}
?>
</nav><!-- #<?php
echo $nav_id;
?>
-->
<?php
}