/** * Display navigation to next/previous comments when applicable. * */ function twentyfifteen_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation" role="navigation"> <h2 class="screen-reader-text"><?php _e('Comment navigation', 'myblog'); ?> </h2> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link(__('Older Comments', 'myblog'))) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments', 'myblog'))) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div> <!-- .nav-links --> </nav><!-- .comment-navigation --> <?php } }
function ultimatum_do_comments() { global $post, $wp_query; if ( ! post_type_supports( $post->post_type, 'comments' ) ) return; if ( have_comments() && ! empty( $wp_query->comments_by_type['comment'] ) ) { echo '<div id="comments" class="entry-comments">'; echo apply_filters( 'ultimatum_title_comments', __( '<h3>Comments</h3>', 'ultimatum' ) ); echo '<ol class="comment-list">'; do_action( 'ultimatum_list_comments' ); echo '</ol>'; //* Comment Navigation $prev_link = get_previous_comments_link( apply_filters( 'ultimatum_prev_comments_link_text', '' ) ); $next_link = get_next_comments_link( apply_filters( 'ultimatum_next_comments_link_text', '' ) ); if ( $prev_link || $next_link ) printf( '<div class="navigation"><div class="alignleft">%s</div><div class="alignright">%s</div></div>', $prev_link, $next_link ); echo '</div>'; } elseif ( 'open' == $post->comment_status && $no_comments_text = apply_filters( 'ultimatum_no_comments_text', '' ) ) { echo '<div id="comments">' . $no_comments_text . '</div>'; } elseif ( $comments_closed_text = apply_filters( 'ultimatum_comments_closed_text', '' ) ) { echo '<div id="comments">' . $comments_closed_text . '</div>'; } }
/** * Display navigation to next/previous comments when applicable. * * @since 1.0.0 */ function toivo_lite_comment_nav($class = '') { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation <?php echo esc_attr($class); ?> " role="navigation"> <h2 class="screen-reader-text"><?php _e('Comment navigation', 'toivo-lite'); ?> </h2> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link(__('← Older Comments', 'toivo-lite'))) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments →', 'toivo-lite'))) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div><!-- .nav-links --> </nav><!-- .comment-navigation --> <?php } }
/** * @ticket 20319 */ public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() { $p = self::factory()->post->create(); $this->go_to(get_permalink($p)); $cpage = get_query_var('cpage'); set_query_var('cpage', ''); $link = get_next_comments_link('Next', 5); $this->assertContains('cpage=2', $link); set_query_var('cpage', $cpage); }
/** * Display navigation to next/previous comments when applicable. */ function bootplate_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <ul class="pager comment-navigation" role="navigation"> <?php if ($prev_link = get_previous_comments_link('Older Comments')) { printf('<div class="pager-prev">%s</div>', $prev_link); } if ($next_link = get_next_comments_link('Newer Comments')) { printf('<div class="pager-next">%s</div>', $next_link); } ?> </ul><!-- .comment-navigation --> <?php } }
/** * Display navigation to next/previous comments when applicable. * * @since 1.0 */ function Radix_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="comment-navigation" role="navigation"> <ul class="pager"> <?php if ($prev_link = get_previous_comments_link(__('<i class="fa fa-chevron-left fa-fw" aria-hidden="true"></i> Older Comments', 'radix'))) { printf('<li class="nav-previous previous">%s</li>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments <i class="fa fa-chevron-right fa-fw" aria-hidden="true"></i>', 'radix'))) { printf('<li class="nav-next next">%s</li>', $next_link); } ?> </ul><!-- .nav-links --> </nav><!-- end .navigation --> <?php } }
function puma_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation u-textAlignCenter" role="navigation"> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link('上一页')) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link('下一页')) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div> </nav> <?php } }
function cleansimplewhite_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation"> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link(__('Older Comments', 'clean-simple-white'))) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments', 'clean-simple-white'))) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div><!-- .nav-links --> </nav><!-- .comment-navigation --> <?php } }
/** * Echo Genesis default comment structure. * * Does the `genesis_list_comments` action. * * Applies the `genesis_title_comments`, `genesis_prev_comments_link_text`, `genesis_next_comments_link_text`, and * `genesis_comments_closed_text` filters. * * @since 1.1.2 * * @uses genesis_get_option() Get theme setting value. * * @global WP_Query $wp_query Query object. * * @return null Return early if on a page with Genesis pages comments off, or on a post with Genesis posts comments off. */ function genesis_do_comments() { global $wp_query; //* Bail if comments are off for this post type if (is_page() && !genesis_get_option('comments_pages') || is_single() && !genesis_get_option('comments_posts')) { return; } if (have_comments() && !empty($wp_query->comments_by_type['comment'])) { genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div id="comments">', 'context' => 'entry-comments')); echo apply_filters('genesis_title_comments', __('<h3>Comments</h3>', 'genesis')); printf('<ol %s>', genesis_attr('comment-list')); do_action('genesis_list_comments'); echo '</ol>'; //* Comment Navigation $prev_link = get_previous_comments_link(apply_filters('genesis_prev_comments_link_text', '')); $next_link = get_next_comments_link(apply_filters('genesis_next_comments_link_text', '')); if ($prev_link || $next_link) { genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'comments-pagination')); printf('<div class="pagination-previous alignleft">%s</div>', $prev_link); printf('<div class="pagination-next alignright">%s</div>', $next_link); echo '</div>'; } echo '</div>'; } elseif ('open' === get_post()->comment_status && ($no_comments_text = apply_filters('genesis_no_comments_text', ''))) { if (genesis_html5()) { echo sprintf('<div %s>', genesis_attr('entry-comments')) . $no_comments_text . '</div>'; } else { echo '<div id="comments">' . $no_comments_text . '</div>'; } } elseif ($comments_closed_text = apply_filters('genesis_comments_closed_text', '')) { if (genesis_html5()) { echo sprintf('<div %s>', genesis_attr('entry-comments')) . $comments_closed_text . '</div>'; } else { echo '<div id="comments">' . $comments_closed_text . '</div>'; } } }
/** * Display navigation to next/previous comments when applicable. */ function fortunato_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation" role="navigation"> <h2 class="screen-reader-text"><?php esc_html_e('Comment navigation', 'fortunato'); ?> </h2> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link('<i class="fa fa-lg fa-angle-double-left spaceRight"></i>' . esc_html__('Older Comments', 'fortunato'))) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(esc_html__('Newer Comments', 'fortunato') . '<i class="fa fa-lg fa-angle-double-right spaceLeft"></i>')) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div><!-- .nav-links --> </nav><!-- .comment-navigation --> <?php } }
/** * Display navigation to next/previous comments when applicable. * * @since Twenty Fifteen 1.0 */ function google_s_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <div class="container-medium gs-mrg-top"> <p class="large"><?php _e('Comment navigation', 'google_s'); ?> </p> <nav class="article-nav gs-mrg-top" role="navigation"> <?php if ($prev_link = get_previous_comments_link(__('Older Comments', 'google_s'))) { printf('<div class="article-nav-link article-nav-link--prev">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments', 'google_s'))) { printf('<div class="article-nav-link article-nav-link--next">%s</div>', $next_link); } ?> </nav><!-- .comment-navigation --> </div> <?php } }
function thesis_comments_navigation($position = 1) { if (get_option('page_comments')) { // Output navigation only if comment pagination is enabled. global $wp_query; $total_pages = get_comment_pages_count(); $current_page = $wp_query->query_vars['cpage']; if ($total_pages > 1) { $nav = "\t\t\t\t<div id=\"comment_nav_{$position}\" class=\"prev_next\">\n"; if ($current_page == $total_pages) { $nav .= "\t\t\t\t\t<p class=\"previous\">"; $nav .= get_previous_comments_link('← ' . __('Previous Comments', 'thesis')); $nav .= "</p>\n"; } elseif ($current_page == 1) { $nav .= "\t\t\t\t\t<p class=\"next\">"; $nav .= get_next_comments_link(__('Next Comments', 'thesis') . ' →'); $nav .= "</p>\n"; } elseif ($current_page < $total_pages) { $nav .= "\t\t\t\t\t<p class=\"previous floated\">"; $nav .= get_previous_comments_link('← ' . __('Previous Comments', 'thesis')); $nav .= "</p>\n"; $nav .= "\t\t\t\t\t<p class=\"next\">"; $nav .= get_next_comments_link(__('Next Comments', 'thesis') . ' →'); $nav .= "</p>\n"; } $nav .= "\t\t\t\t</div>\n\n"; echo apply_filters('thesis_comments_navigation', $nav, $position); #filter } } }
/** * @param array $args * * @return string */ function get_next_comments_link($args = array()) { $args = wp_parse_args($args, array('format' => '<div class="nav-next">%link</div>', 'link_text' => esc_html__('Newer Comments', 'wplib'), 'max_page' => 0)); $link = get_next_comments_link($args['label'], $args['max_page']); return $link ? str_replace('%link', $link, $args['format']) : ''; }
function HuI_comment_nav() { // Are there comments to navigate through? if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation text-center clearfix" role="navigation"> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link('上一页')) { printf('<div class="nav-previous pull-left">%s</div>', $prev_link); } if ($next_link = get_next_comments_link('下一页')) { printf('<div class="nav-next pull-right">%s</div>', $next_link); } ?> </div><!-- .nav-links --> </nav><!-- .comment-navigation --> <?php } }
* Additional settings are available under the Appearance -> Theme Options -> Comments. * */ if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die('Please do not load this page directly. Thanks!'); } if (post_password_required()) { theme_post_wrapper(array('content' => '<p class="nocomments">' . __('This post is password protected. Enter the password to view any comments.', THEME_NS) . '</p>')); return; } if (have_comments()) { theme_ob_start(); printf(_n('One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), THEME_NS), number_format_i18n(get_comments_number()), '<em>' . get_the_title() . '</em>'); theme_post_wrapper(array('content' => '<h4 id="comments">' . theme_ob_get_clean() . '</h4>')); $prev_link = get_previous_comments_link(__('<span class="meta-nav">←</span> Older Comments', THEME_NS)); $next_link = get_next_comments_link(__('Newer Comments <span class="meta-nav">→</span>', THEME_NS)); theme_page_navigation(array('prev_link' => $prev_link, 'next_link' => $next_link)); echo '<ul id="comments-list">'; wp_list_comments('type=all&callback=theme_comment'); echo '</ul>'; theme_page_navigation(array('prev_link' => $prev_link, 'next_link' => $next_link)); } theme_ob_start(); $args = array(); if (theme_get_option('theme_comment_use_smilies')) { function theme_comment_form_field_comment($form_field) { theme_include_lib('smiley.php'); return theme_get_smilies_js() . '<p class="smilies">' . theme_get_smilies() . '</p>' . $form_field; } add_filter('comment_form_field_comment', 'theme_comment_form_field_comment');
if (have_comments()) { ?> <div class="comments-block content-block cf"> <div class="title-wrapper"> <h2 class="block-title with-icon" data-icon=""> <?php printf(_n('One comment', '%1$s comments', get_comments_number(), 'reach'), number_format_i18n(get_comments_number())); ?> </h2> </div> <?php /* Are there comments to navigate through */ if (get_comment_pages_count() > 1 && get_option('page_comments')) { $next_link = get_next_comments_link('<i class="icon-angle-right"></i>'); $previous_link = get_previous_comments_link('<i class="icon-angle-left"></i>'); ?> <nav id="comment-nav-above" class="comment-nav pagination"> <h1 class="assistive-text"><?php _e('Comment navigation', 'reach'); ?> </h1> <ul> <?php if (strlen($previous_link)) { ?> <li class="nav-previous"><?php echo $previous_link; ?> </li><?php
<div class="multiseparator"></div> <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="navigation comment-navigation" role="navigation"> <h2 class="screen-reader-text"><?php _e('Comment navigation', 'twentyfifteen'); ?> </h2> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link(__('Older Comments', 'twentyfifteen'))) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments', 'twentyfifteen'))) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div> </nav> <?php } ?> <?php } ?> <?php if (!comments_open() && get_comments_number() && post_type_supports(get_post_type(), 'comments')) {
function barcelona_comments_nav($position = 'top') { if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="comments-nav comments-nav-<?php echo sanitize_html_class($position); ?> "> <ul class="clearfix"> <?php if ($prev_link = get_previous_comments_link(esc_html__('« Older Comments', 'barcelona'))) { printf('<li class="nav-previous">%s</li>', $prev_link); } if ($next_link = get_next_comments_link(esc_html__('Newer Comments »', 'barcelona'))) { printf('<li class="nav-next">%s</li>', $next_link); } ?> </ul> </nav><!-- .comments-nav --> <?php } }
function delim_comment_link() { $prev = get_previous_comments_link(); $next = get_next_comments_link(); if ($prev && $next) { $d = " | "; echo apply_filters('comment_link_delim', $d); } }
<?php if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die('Please do not load this page directly. Thanks!'); } if (post_password_required()) { theme_post_wrapper(array('content' => '<p class="nocomments">' . __('This post is password protected. Enter the password to view any comments.', THEME_NS) . '</p>')); return; } if (have_comments()) { ob_start(); printf(_n('One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), THEME_NS), number_format_i18n(get_comments_number()), '<em>' . get_the_title() . '</em>'); theme_post_wrapper(array('content' => '<h4 id="comments">' . ob_get_clean() . '</h4>')); $prev_link = get_previous_comments_link(__('Newer Comments <span class="meta-nav">→</span>', THEME_NS)); $next_link = get_next_comments_link(__('<span class="meta-nav">←</span> Older Comments', THEME_NS)); theme_page_navigation(array('prev_link' => $prev_link, 'next_link' => $next_link)); echo '<ul id="comments-list">'; wp_list_comments('type=all&callback=theme_comment'); echo '</ul>'; theme_page_navigation(array('prev_link' => $prev_link, 'next_link' => $next_link)); } elseif ('open' != $post->comment_status && !is_page()) { theme_post_wrapper(array('content' => '<p class="nocomments">' . __('Comments are closed.', THEME_NS) . '</p>')); } if (function_exists('comment_form')) { ob_start(); $args = array(); if (theme_get_option('theme_comment_use_smilies')) { function theme_comment_form_field_comment($form_field) { theme_include_lib('smiley.php'); return theme_get_smilies_js() . '<p class="smilies">' . theme_get_smilies() . '</p>' . $form_field;
/** * Display the navigation for comments. * * @since 4.0.0 * @param string $position Navigation position - above or below? */ function cherry_comments_nav($position = '') { if (get_comment_pages_count() > 1 && get_option('page_comments')) { printf('<nav id="comment-nav-%3$s" class="comment-navigation" role="navigation"><div class="nav-previous">%1$s</div><div class="nav-next">%2$s</div></nav>', get_previous_comments_link(__('← Older Comments', 'cherry')), get_next_comments_link(__('Newer Comments →', 'cherry')), $position); } }
if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav> <ul class="pager"> <?php if (get_previous_comments_link()) { ?> <li class="previous"><?php previous_comments_link(__('← Older comments', 'sage')); ?> </li> <?php } ?> <?php if (get_next_comments_link()) { ?> <li class="next"><?php next_comments_link(__('Newer comments →', 'sage')); ?> </li> <?php } ?> </ul> </nav> <?php } ?> <?php }
function fnbx_post_navigation($direction = '', $type = '') { $post_nav_defaults = array('layout' => array('tag' => 'div', 'tag_content_before' => "\n", 'tag_content_after' => "\n", 'return' => true), 'options' => array('format' => '', 'link' => '%title', 'in_same_cat' => false, 'excluded_categories' => '', 'previous' => true)); switch ($direction) { case 'previous': $post_nav_defaults['layout']['class'] = 'nav-previous'; if ($type == 'comment') { $post_nav_defaults['options']['format'] = __('Older Comments', 'fnbx_lang'); } elseif ($type == 'post') { $post_nav_defaults['options']['format'] = __('%link', 'fnbx_lang'); } elseif ($type == 'search') { $post_nav_defaults['options']['format'] = __('Newer Results', 'fnbx_lang'); } else { $post_nav_defaults['options']['format'] = __('Newer Posts', 'fnbx_lang'); } $post_nav_defaults['options']['previous'] = true; break; case 'next': $post_nav_defaults['layout']['class'] = 'nav-next'; if ($type == 'comment') { $post_nav_defaults['options']['format'] = __('Newer Comments', 'fnbx_lang'); } elseif ($type == 'post') { $post_nav_defaults['options']['format'] = __('%link', 'fnbx_lang'); } elseif ($type == 'search') { $post_nav_defaults['options']['format'] = __('Older Results', 'fnbx_lang'); } else { $post_nav_defaults['options']['format'] = __('Older Posts', 'fnbx_lang'); } $post_nav_defaults['options']['previous'] = false; break; } $post_nav_defaults = apply_filters('fnbx_post_nav_defaults', $post_nav_defaults); switch ($type) { case 'post': $post_nav_defaults['layout']['tag_content'] = fnbx_get_adjacent_post_link($post_nav_defaults['options']['format'], $post_nav_defaults['options']['link'], $post_nav_defaults['options']['in_same_cat'], $post_nav_defaults['options']['excluded_categories'], $post_nav_defaults['options']['previous']); break; case 'posts': if ($direction == 'previous') { $post_nav_defaults['layout']['tag_content'] = get_previous_posts_link($post_nav_defaults['options']['format']); } if ($direction == 'next') { $post_nav_defaults['layout']['tag_content'] = get_next_posts_link($post_nav_defaults['options']['format']); } break; case 'search': if ($direction == 'previous') { $post_nav_defaults['layout']['tag_content'] = get_previous_posts_link($post_nav_defaults['options']['format']); } if ($direction == 'next') { $post_nav_defaults['layout']['tag_content'] = get_next_posts_link($post_nav_defaults['options']['format']); } break; case 'image': if ($direction == 'previous') { $post_nav_defaults['layout']['tag_content'] = fnbx_get_adjacent_image_link(true, 'thumbnail', false); } if ($direction == 'next') { $post_nav_defaults['layout']['tag_content'] = fnbx_get_adjacent_image_link(false, 'thumbnail', false); } break; case 'comment': if ($direction == 'previous') { $post_nav_defaults['layout']['tag_content'] = get_previous_comments_link($post_nav_defaults['options']['format']); } if ($direction == 'next') { $post_nav_defaults['layout']['tag_content'] = get_next_comments_link($post_nav_defaults['options']['format']); } break; } if (!empty($post_nav_defaults['layout']['tag_content'])) { switch ($direction) { case 'previous': $post_nav_defaults['layout']['tag_content'] = $post_nav_defaults['layout']['tag_content']; break; case 'next': $post_nav_defaults['layout']['tag_content'] = $post_nav_defaults['layout']['tag_content']; break; } $post_nav_defaults['layout'] = apply_filters("fnbx_post_navigation_{$direction}", $post_nav_defaults['layout']); return fnbx_html_tag($post_nav_defaults['layout']); } }
function wm_comments_navigation($container_id = 'comment-nav-above') { //Helper variables $output = array(); $container_id = esc_attr(sanitize_html_class(trim($container_id))); //Preparing output $output[10] = '<nav id="' . $container_id . '" class="navigation comment-navigation ' . $container_id . '" role="navigation">'; $output[20] = '<h3 class="screen-reader-text">' . __('Comment navigation', 'wm_domain') . '</h3>'; $output[30] = '<div class="nav-previous">' . get_previous_comments_link(__('← Older comments', 'wm_domain')) . '</div>'; $output[40] = '<div class="nav-next">' . get_next_comments_link(__('Newer comments →', 'wm_domain')) . '</div>'; $output[50] = '</nav>'; //Output $output = apply_filters('wmhook_wm_comments_navigation_output', $output); return implode('', $output); }
/** * Comment Navigation * * Simple older/newer navigation links for paginated * comments * * @since 1.0.0 * @author Daniel Pataki * */ function scribe_comment_nav() { if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?> <nav class="comment-navigation" role="navigation"> <div class="nav-links"> <?php if ($prev_link = get_previous_comments_link(__('Older Comments', 'scribe'))) { printf('<div class="nav-previous">%s</div>', $prev_link); } if ($next_link = get_next_comments_link(__('Newer Comments', 'scribe'))) { printf('<div class="nav-next">%s</div>', $next_link); } ?> </div> </nav> <?php } }
/** * function thesis_comments_navigation() * * Display comment navigation links * * @since 1.5 */ function thesis_comments_navigation($position = 1) { // Output navigation only if comment pagination is enabled. if (get_option('page_comments')) { $total_pages = get_comment_pages_count(); $default_page = get_option('default_comments_page') == 'oldest' ? 1 : $total_pages; $current_page = isset($_GET['cpage']) ? get_query_var('cpage') : $default_page; if ($total_pages > 1) { $nav = ' <div id="comment_nav_' . $position . '" class="prev_next">' . "\n"; if ($current_page == $total_pages) { $nav .= ' <p class="previous">'; $nav .= get_previous_comments_link('← ' . __('Previous Comments', 'thesis')); $nav .= "</p>\n"; } elseif ($current_page == 1) { $nav .= ' <p class="next">'; $nav .= get_next_comments_link(__('Next Comments', 'thesis') . ' →'); $nav .= "</p>\n"; } elseif ($current_page < $total_pages) { $nav .= ' <p class="previous floated">'; $nav .= get_previous_comments_link('← ' . __('Previous Comments', 'thesis')); $nav .= "</p>\n"; $nav .= ' <p class="next">'; $nav .= get_next_comments_link(__('Next Comments', 'thesis') . ' →'); $nav .= "</p>\n"; } $nav .= "\t\t\t\t</div>\n\n"; echo apply_filters('thesis_comments_navigation', $nav, $position); } } }
/** * Returns navigation to next/previous set of comments when applicable. * * @since 4.4.0 * * @param array $args { * Optional. Default comments navigation arguments. * * @type string $prev_text Anchor text to display in the previous comments link. Default 'Older comments'. * @type string $next_text Anchor text to display in the next comments link. Default 'Newer comments'. * @type string $screen_reader_text Screen reader text for nav element. Default 'Comments navigation'. * } * @return string Markup for comments links. */ function get_the_comments_navigation($args = array()) { $navigation = ''; // Are there comments to navigate through? if (get_comment_pages_count() > 1) { $args = wp_parse_args($args, array('prev_text' => __('Older comments'), 'next_text' => __('Newer comments'), 'screen_reader_text' => __('Comments navigation'))); $prev_link = get_previous_comments_link($args['prev_text']); $next_link = get_next_comments_link($args['next_text']); if ($prev_link) { $navigation .= '<div class="nav-previous">' . $prev_link . '</div>'; } if ($next_link) { $navigation .= '<div class="nav-next">' . $next_link . '</div>'; } $navigation = _navigation_markup($navigation, 'comment-navigation', $args['screen_reader_text']); } return $navigation; }
/** * Comments navigation rendering * * @package Customizr * @since Customizr 3.0 */ function tc_comment_navigation() { if (get_comment_pages_count() > 1 && get_option('page_comments')) { // are there comments to navigate through ob_start(); ?> <nav id="comment-nav-below" class="navigation" role="navigation"> <h3 class="assistive-text section-heading"><?php _e('Comment navigation', 'customizr'); ?> </h3> <ul class="pager"> <?php if (get_previous_comments_link() != null) { ?> <li class="previous"> <span class="nav-previous"><?php previous_comments_link(__('<span class="meta-nav">←</span> Older Comments', 'customizr')); ?> </span> </li> <?php } ?> <?php if (get_next_comments_link() != null) { ?> <li class="next"> <span class="nav-next"><?php next_comments_link(__('Newer Comments <span class="meta-nav">→</span>', 'customizr')); ?> </span> </li> <?php } ?> </ul> </nav> <?php $html = ob_get_contents(); ob_end_clean(); echo apply_filters('tc_comment_navigation', $html); } // check for comment navigation }
/** * Display the link to next comments page. * * @since 2.7.0 * * @param string $label Optional. Label for link text. * @param int $max_page Optional. Max page. */ function next_comments_link($label = '', $max_page = 0) { echo get_next_comments_link($label, $max_page); }
/** * Echo comments navigation. * * @since 1.0.0 */ function beans_comments_navigation() { if (get_comment_pages_count() <= 1 && !get_option('page_comments')) { return; } echo beans_open_markup('beans_comments_navigation', 'ul', array('class' => 'uk-pagination', 'role' => 'navigation')); // Previous. if (get_previous_comments_link()) { echo beans_open_markup('beans_comments_navigation_item[_previous]', 'li', array('class' => 'uk-pagination-previous')); $previous_icon = beans_open_markup('beans_previous_icon[_comments_navigation]', 'i', array('class' => 'uk-icon-angle-double-left uk-margin-small-right')); $previous_icon .= beans_close_markup('beans_previous_icon[_comments_navigation]', 'i'); echo get_previous_comments_link($previous_icon . beans_output('beans_previous_text[_comments_navigation]', __('Previous', 'tm-beans'))); echo beans_close_markup('beans_comments_navigation_item[_previous]', 'li'); } // Next. if (get_next_comments_link()) { echo beans_open_markup('beans_comments_navigation_item[_next]', 'li', array('class' => 'uk-pagination-next')); $next_icon = beans_open_markup('beans_next_icon[_comments_navigation]', 'i', array('class' => 'uk-icon-angle-double-right uk-margin-small-right')); $next_icon .= beans_close_markup('beans_previous_icon[_comments_navigation]', 'i'); echo get_next_comments_link(beans_output('beans_next_text[_comments_navigation]', __('Next', 'tm-beans')) . $next_icon); echo beans_close_markup('beans_comments_navigation_item_[_next]', 'li'); } echo beans_close_markup('beans_comments_navigation', 'ul'); }