get_comment_pages_count example

if ( ! $page ) {
        $page = 1;
    }

    $next_page = (int) $page + 1;

    if ( empty( $max_page ) ) {
        $max_page = $wp_query->max_num_comment_pages;
    }

    if ( empty( $max_page ) ) {
        $max_page = get_comment_pages_count();
    }

    if ( $next_page > $max_page ) {
        return;
    }

    if ( empty( $label ) ) {
        $label = __( 'Newer Comments »' );
    }

    /** * Filters the anchor tag attributes for the next comments page link. * * @since 2.7.0 * * @param string $attributes Attributes for the anchor tag. */
if ( $separate_comments ) {
        $wp_query->comments_by_type = separate_comments( $comments );
        $comments_by_type           = &$wp_query->comments_by_type;
    } else {
        $wp_query->comments_by_type = array();
    }

    $overridden_cpage = false;

    if ( '' == get_query_var( 'cpage' ) && $wp_query->max_num_comment_pages > 1 ) {
        set_query_var( 'cpage', 'newest' === get_option( 'default_comments_page' ) ? get_comment_pages_count() : 1 );
        $overridden_cpage = true;
    }

    if ( ! defined( 'COMMENTS_TEMPLATE' ) ) {
        define( 'COMMENTS_TEMPLATE', true );
    }

    $theme_template = STYLESHEETPATH . $file;

    /** * Filters the path to the theme template file used for the comments template. * * @since 1.5.1 * * @param string $theme_template The path to the theme template file. */
Home | Imprint | This part of the site doesn't use cookies.