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 }
function page_navi($before = '', $after = '') { global $wpdb, $wp_query; $request = $wp_query->request; $posts_per_page = intval(get_query_var('posts_per_page')); $paged = intval(get_query_var('paged')); $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; if ($numposts <= $posts_per_page) { return; } if (empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = 3; $pages_to_show_minus_1 = $pages_to_show - 1; $half_page_start = floor($pages_to_show_minus_1 / 2); $half_page_end = ceil($pages_to_show_minus_1 / 2); $start_page = $paged - $half_page_start; if ($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if ($end_page - $start_page != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if ($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if ($start_page <= 0) { $start_page = 1; } echo $before . '<div class="pagination_wrapper"><ul class="pagination">' . ""; if ($paged > 1) { $first_page_text = "First"; echo '<li class="prev"><a href="' . get_pagenum_link() . '" title="First">' . $first_page_text . '</a></li>'; } $prevposts = get_previous_posts_link('Prev'); if ($prevposts) { echo '<li>' . $prevposts . '</li>'; } else { echo '<li class="disabled"><a href="#">Prev</a></li>'; } for ($i = $start_page; $i <= $end_page; $i++) { if ($i == $paged) { echo '<li class="active"><a href="#">' . $i . '</a></li>'; } else { echo '<li><a href="' . get_pagenum_link($i) . '">' . $i . '</a></li>'; } } if ($end_page < $max_page) { $last_page_text = $max_page; echo '<li class="next"><a href="' . get_pagenum_link($max_page) . '" title="Last">' . $last_page_text . '</a></li>'; } echo '<li class="">'; next_posts_link('Next'); echo '</li>'; echo '</ul></div>' . $after . ""; }
/** * 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 }
function getpagenavi() { ?> <div id="navigation"> <?php if (function_exists('wp_simple_pagination')) { wp_simple_pagination(); ?> <?php } else { ?> <div class="alignleft"><?php next_posts_link(__('« Старые записи', 'web2feel')); ?> </div> <div class="alignright"><?php previous_posts_link(__('Новые записи »', 'web2feel')); ?> </div> <div class="clear"></div> <?php } ?> </div> <?php }
/** * tarski_posts_nav_link() - Outputs next / previous index page links. * * @since 1.2 * @global object $wp_query * @return string */ function tarski_posts_nav_link() { if (get_tarski_option('use_pages')) { global $wp_query; if (!is_singular()) { $max_num_pages = $wp_query->max_num_pages; $paged = get_query_var('paged'); $sep = ' § '; // Only have sep if there's both prev and next results if ($paged < 2 || $paged >= $max_num_pages) { $sep = ''; } if ($max_num_pages > 1) { echo '<p class="pagination">'; if (is_search()) { previous_posts_link('« ' . __('Previous results', 'tarski')); echo $sep; next_posts_link(__('More results', 'tarski') . ' »'); } else { next_posts_link('« ' . __('Older entries', 'tarski')); echo $sep; previous_posts_link(__('Newer entries', 'tarski') . ' »'); } echo "</p>\n"; } } } }
/** * Displays navigation to next/previous pages when applicable. * * @since Twenty Twelve 1.0 */ function twentytwelve_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"> <h3 class="assistive-text"><?php _e('Post navigation', 'twentytwelve'); ?> </h3> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'twentytwelve')); ?> </div> <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'twentytwelve')); ?> </div> </nav><!-- #<?php echo $html_id; ?> .navigation --> <?php } }
/** * 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 }
/** * 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 } }
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 }
/** * 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 }
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 } }
/** * 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 }
/** * 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 }
/** * 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 } }
/** * 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 } }
/** * Display navigation to older set of posts when applicable. */ function cinnamon_paging_nav_older() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } ?> <?php if (get_next_posts_link()) { ?> <nav class="navigation paging-navigation older" role="navigation"> <h1 class="screen-reader-text"><?php _e('Posts navigation', 'cinnamon'); ?> </h1> <div class="nav-links"> <div class="nav-previous"><?php next_posts_link(__('More stories', 'cinnamon')); ?> </div> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php } ?> <?php }
/** * Display navigation to next/previous set of posts when applicable. * * @return void */ function sketch_paging_nav( $max_num_pages = '' ) { // Get max_num_pages if not provided if ( '' == $max_num_pages ) $max_num_pages = $GLOBALS['wp_query']->max_num_pages; // Don't print empty markup if there's only one page. if ( $max_num_pages < 2 ) { return; } ?> <nav class="navigation paging-navigation clear" role="navigation"> <h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'sketch' ); ?></h1> <div class="nav-links"> <?php if ( get_next_posts_link( '', $max_num_pages ) ) : ?> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">Previous</span>', 'sketch' ), $max_num_pages ); ?></div> <?php endif; ?> <?php if ( get_previous_posts_link( '', $max_num_pages ) ) : ?> <div class="nav-next"><?php previous_posts_link( __( '<span class="meta-nav">Next</span>', 'sketch' ), $max_num_pages ); ?></div> <?php endif; ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous pages when applicable */ function beach_content_nav($nav_id) { global $wp_query; if ($wp_query->max_num_pages > 1) { ?> <nav id="<?php echo $nav_id; ?> "> <h1 class="section-heading"><?php _e('Post navigation', 'beach'); ?> </h1> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'beach')); ?> </div> <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'beach')); ?> </div> </nav><!-- #nav-above --> <?php } }
function getpagenavi() { ?> <div id="navigation" class="clearfix"> <?php if (function_exists('wp_pagenavi')) { ?> <?php wp_pagenavi(); ?> <?php } else { ?> <div class="alignleft"><?php next_posts_link(__('« Older Entries', 'web2feeel')); ?> </div> <div class="alignright"><?php previous_posts_link(__('Newer Entries »', 'web2feel')); ?> </div> <div class="clear"></div> <?php } ?> </div> <?php }
function nice_pagenavi() { if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <?php if (get_next_posts_link() || get_previous_posts_link()) { ?> <nav class="nav-entries"> <?php next_posts_link('<div class="nav-prev fl">' . __('Older posts', 'nicethemes') . '</div>'); ?> <?php previous_posts_link('<div class="nav-next fr">' . __('Newer posts', 'nicethemes') . '</div>'); ?> <div class="fix"></div> </nav> <?php } ?> <?php } }
/** * 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 } }
/** * Display navigation to next/previous pages when applicable * * @global WP_Query $wp_query * @param string $nav_id DOM ID for this navigation * @since 1.0 * not used */ function bpmagic_posts_nav($nav_id) { global $wp_query; if (!empty($wp_query->max_num_pages) && $wp_query->max_num_pages > 1) { ?> <div id="<?php echo $nav_id; ?> " class="navigation"> <div class="alignleft"><?php next_posts_link(__('← Previous Entries', 'bp-magic')); ?> </div> <div class="alignright"><?php previous_posts_link(__('Next Entries →', 'bp-magic')); ?> </div> <div class="clear"></div> </div><!-- #<?php echo $nav_id; ?> --> <?php } }
/** * 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 } }
function woo_pagenav() { global $woo_options; // If the user has set the option to use simple paging links, display those. By default, display the pagination. if (array_key_exists('woo_pagination_type', $woo_options) && $woo_options['woo_pagination_type'] == 'simple') { if (get_next_posts_link() || get_previous_posts_link()) { ?> <div class="nav-entries"> <?php next_posts_link('<span class="nav-prev fl">' . __('<span class="meta-nav">←</span> Older posts', 'woothemes') . '</span>'); ?> <?php previous_posts_link('<span class="nav-next fr">' . __('Newer posts <span class="meta-nav">→</span>', 'woothemes') . '</span>'); ?> <div class="fix"></div> </div> <?php } // ENDIF } else { woo_pagination(); } // ENDIF }
/** * Sets up the previous post link and applies a filter to the link text. * * @since 1.0 */ function response_previous_posts() { $previous_text = apply_filters('response_previous_posts_text', '« Older Entries'); echo "<div class='pagnext-posts'>"; next_posts_link(__($previous_text, 'response')); echo "</div>"; }
/** * Function: theme_content_nav - Displays navigation to next/previous pages when applicable in WP pagination * @Author: JF * @Date: 2014 Jan * * @return void */ public static function theme_content_nav($html_id) { global $wp_query; $html_id = esc_attr($html_id); if ($wp_query->max_num_pages > 1) { ?> <div id="<?php echo $html_id; ?> " class="row-fluid" role="navigation"> <div class="span6"><?php next_posts_link(__('<i class="icon-arrow-left"></i> Older posts', SITE_TEXT_DOMAIN)); ?> </div> <div class="span6 text-right"><?php previous_posts_link(__('Newer posts <i class="icon-arrow-right"></i>', SITE_TEXT_DOMAIN)); ?> </div> </div><!-- #<?php echo $html_id; ?> .navigation --> <?php } }
/** * 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 } }
/** * Display navigation to next/previous pages when applicable * * @since Sunspot 1.0 */ function sunspot_content_nav( $nav_id ) { global $wp_query; $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', 'sunspot' ); ?></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', 'sunspot' ) . '</span> %title' ); ?> <?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'sunspot' ) . '</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 ( get_next_posts_link() ) : ?> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'sunspot' ) ); ?></div> <?php endif; ?> <?php if ( get_previous_posts_link() ) : ?> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'sunspot' ) ); ?></div> <?php endif; ?> <?php endif; ?> </nav><!-- #<?php echo $nav_id; ?> --> <?php }
function basics_content_nav($nav_id, $nav_class) { global $wp_query; if ($wp_query->max_num_pages > 0) { ?> <nav id="<?php echo $nav_id; ?> " class="<?php echo $nav_class; ?> " role="navigation"> <h1 class="visuallyhidden"><?php _e('Post navigation', 'basics'); ?> </h1> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">↖</span> Older posts', 'basics')); ?> </div> <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">↗</span>', 'basics')); ?> </div> </nav><!-- eo #<?php echo $nav_id; ?> .<?php echo $nav_class; ?> --> <?php } }
function gallery_nav_below() { if (!is_single()) { ?> <div id="nav-below" class="navigation"> <?php if (function_exists('wp_pagenavi')) { ?> <?php wp_pagenavi(); ?> <?php } else { ?> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older products', 'thematic')); ?> </div> <div class="nav-next"><?php previous_posts_link(__('Newer products <span class="meta-nav">»</span>', 'thematic')); ?> </div> <?php } ?> </div> <?php } }