当前位置: 首页>>代码示例>>PHP>>正文


PHP get_comment_pages_count函数代码示例

本文整理汇总了PHP中get_comment_pages_count函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comment_pages_count函数的具体用法?PHP get_comment_pages_count怎么用?PHP get_comment_pages_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_comment_pages_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toivo_lite_comment_nav

    /**
     * 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(__('&larr; Older Comments', 'toivo-lite'))) {
                printf('<div class="nav-previous">%s</div>', $prev_link);
            }
            if ($next_link = get_next_comments_link(__('Newer Comments &rarr;', 'toivo-lite'))) {
                printf('<div class="nav-next">%s</div>', $next_link);
            }
            ?>
		</div><!-- .nav-links -->
	</nav><!-- .comment-navigation -->
	<?php 
        }
    }
开发者ID:kimyj9501,项目名称:SingMyStory,代码行数:32,代码来源:template-tags.php

示例2: twentyfifteen_comment_nav

    /**
     * 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 
        }
    }
开发者ID:peymanslh,项目名称:MyBlog,代码行数:30,代码来源:template-tags.php

示例3: get_comment_nav

function get_comment_nav()
{
    ?>

	<?php 
    if (get_comment_pages_count() > 1) {
        ?>
	<div class="comments-nav">
		<div class="prev">
			<?php 
        previous_comments_link(__('Prev Comments', 'rb'));
        ?>
		</div>
		<div class="next">
			<?php 
        next_comments_link(__('Next Comments', 'rb'));
        ?>
		</div>
	</div>
	<?php 
    }
    ?>

<?php 
}
开发者ID:anaved,项目名称:wordpress-tinkering,代码行数:25,代码来源:comments.php

示例4: tamatebako_comments_nav

/**
 * Comments Nav
 * @since 0.1.0
 */
function tamatebako_comments_nav()
{
    if (get_option('page_comments') && 1 < get_comment_pages_count()) {
        // Check for paged comments.
        ?>

	<div class="comments-nav">

		<?php 
        previous_comments_link('<span class="prev-comments"><span class="screen-reader-text">' . tamatebako_string('previous_comment') . '</span></span>');
        ?>

		<span class="page-numbers"><?php 
        printf('%1$s / %2$s', get_query_var('cpage') ? absint(get_query_var('cpage')) : 1, get_comment_pages_count());
        ?>
</span>

		<?php 
        next_comments_link('<span class="next-comments"><span class="screen-reader-text">' . tamatebako_string('next_comment') . '</span></span>');
        ?>

	</div><!-- .comments-nav -->

<?php 
    }
    // End check for paged comments.
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:31,代码来源:comment.php

示例5: paginate

 /**
  * Pagination based on options/args
  */
 function paginate($args = false)
 {
     if ($this->type === 'comments' && !get_option('page_comments')) {
         return;
     }
     $r = wp_parse_args($args, $this->options);
     extract($r, EXTR_SKIP);
     if (!isset($page) && !isset($pages)) {
         global $wp_query;
         if ($this->type === 'posts') {
             $page = get_query_var('paged');
             $posts_per_page = intval(get_query_var('posts_per_page'));
             $pages = intval(ceil($wp_query->found_posts / $posts_per_page));
         } else {
             $page = get_query_var('cpage');
             $comments_per_page = get_option('comments_per_page');
             $pages = get_comment_pages_count();
         }
         $page = !empty($page) ? intval($page) : 1;
     }
     $prevlink = $this->type === 'posts' ? esc_url(get_pagenum_link($page - 1)) : get_comments_pagenum_link($page - 1);
     $nextlink = $this->type === 'posts' ? esc_url(get_pagenum_link($page + 1)) : get_comments_pagenum_link($page + 1);
     $output = stripslashes($before);
     if ($pages > 1) {
         $output .= sprintf('<ol class="wp-paginate%s">', $this->type === 'posts' ? '' : ' wp-paginate-comments');
         if (strlen(stripslashes($title)) > 0) {
             $output .= sprintf('<li><span class="title">%s</span></li>', stripslashes($title));
         }
         $ellipsis = "<li><span class='gap'>...</span></li>";
         if ($page > 1 && !empty($previouspage)) {
             $output .= sprintf('<li><a href="%s" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
         }
         $min_links = $range * 2 + 1;
         $block_min = min($page - $range, $pages - $min_links);
         $block_high = max($page + $range, $min_links);
         $left_gap = $block_min - $anchor - $gap > 0 ? true : false;
         $right_gap = $block_high + $anchor + $gap < $pages ? true : false;
         if ($left_gap && !$right_gap) {
             $output .= sprintf('%s%s%s', $this->paginate_loop(1, $anchor), $ellipsis, $this->paginate_loop($block_min, $pages, $page));
         } else {
             if ($left_gap && $right_gap) {
                 $output .= sprintf('%s%s%s%s%s', $this->paginate_loop(1, $anchor), $ellipsis, $this->paginate_loop($block_min, $block_high, $page), $ellipsis, $this->paginate_loop($pages - $anchor + 1, $pages));
             } else {
                 if ($right_gap && !$left_gap) {
                     $output .= sprintf('%s%s%s', $this->paginate_loop(1, $block_high, $page), $ellipsis, $this->paginate_loop($pages - $anchor + 1, $pages));
                 } else {
                     $output .= $this->paginate_loop(1, $pages, $page);
                 }
             }
         }
         if ($page < $pages && !empty($nextpage)) {
             $output .= sprintf('<li><a href="%s" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
         }
         $output .= "</ol>";
     }
     $output .= stripslashes($after);
     if ($pages > 1 || $empty) {
         echo $output;
     }
 }
开发者ID:bsboby,项目名称:Sample-code-frontend-dev,代码行数:63,代码来源:wp-paginate.php

示例6: thb_comments_navigation

 function thb_comments_navigation()
 {
     global $post;
     if (get_comment_pages_count() > 1 && get_option('page_comments')) {
         previous_comments_link(__('Older comments', 'thb_text_domain'));
         next_comments_link(__('Newer comments', 'thb_text_domain'));
     }
 }
开发者ID:alfredpp,项目名称:sarath-portfolio,代码行数:8,代码来源:helper.comments.php

示例7: getPagesCount

 public static function getPagesCount($comments)
 {
     if (class_exists(InnThemeComment::class) && method_exists(InnThemeComment::class, 'getPagesCount')) {
         return InnThemeComment::getPagesCount($comments);
     }
     static $count = null;
     if ($count === null) {
         $count = \get_comment_pages_count($comments, Other::getOption('comments_per_page'), Other::getOption('thread_comments'));
     }
     return $count;
 }
开发者ID:kmvan,项目名称:poiauthor,代码行数:11,代码来源:Api.php

示例8: get_total_comment_pages

 /**
  * Retrieve the total number of comment pages.
  *
  * @return int $total Total number of comment pages.
  */
 public function get_total_comment_pages()
 {
     global $wp_query;
     // get max page from query
     if (!empty($wp_query->max_num_comment_pages)) {
         $max_page = $wp_query->max_num_comment_pages;
     }
     // if there is no max page in the query, calculate it
     if (empty($max_page)) {
         $max_page = get_comment_pages_count();
     }
     return intval(max($max_page, 1));
 }
开发者ID:2createstudio,项目名称:carbon-pagination,代码行数:18,代码来源:Carbon_Pagination_Comments.php

示例9: comments_title

 function comments_title()
 {
     global $wp_query;
     $ppage = get_query_var('comments_per_page');
     $num = get_comments_number();
     // Subtract pings from this number
     $num -= count($wp_query->comments_by_type['pings']);
     if ($num > $ppage) {
         echo sprintf(__('Comments (page %d of %d)', 'guangzhou'), get_query_var('cpage'), get_comment_pages_count());
     } else {
         if ($num > 0) {
             echo sprintf(_n('%d Comment', '%d Comments', $num, 'guangzhou'), $num);
         } else {
             _e('No comments', 'guangzhou');
         }
     }
 }
开发者ID:billerby,项目名称:Surdeg,代码行数:17,代码来源:comments.php

示例10: bootplate_comment_nav

    /**
     * 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 
        }
    }
开发者ID:jdmdigital,项目名称:bootplate,代码行数:21,代码来源:template-tags.php

示例11: Radix_comment_nav

    /**
     * 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 
        }
    }
开发者ID:liyanouou,项目名称:wordpress,代码行数:25,代码来源:template-tags.php

示例12: cleansimplewhite_comment_nav

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 
    }
}
开发者ID:pedroddf,项目名称:wordpress-bootstrap-theme,代码行数:20,代码来源:comments.php

示例13: puma_comment_nav

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 
    }
}
开发者ID:zhboner,项目名称:Modified-Puma,代码行数:20,代码来源:comment-action.php

示例14: scaffolder_comment_nav

/**
 * Comments nav
 */
function scaffolder_comment_nav()
{
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        ?>
        <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
            <h1 class="screen-reader-text"><?php 
        _e('Comment navigation', 'scaffold');
        ?>
</h1>
            <div class="nav-previous"><?php 
        previous_comments_link(__('&larr; Older Comments', 'scaffold'));
        ?>
</div>
            <div class="nav-next"><?php 
        next_comments_link(__('Newer Comments &rarr;', 'scaffold'));
        ?>
</div>
        </nav>
    <?php 
    }
}
开发者ID:360ecommerce,项目名称:scaffolder,代码行数:24,代码来源:helpers.php

示例15: the_bootstrap_comment_nav

    /**
     * Display navigation to next/previous comments pages when applicable
     *
     * @author	Konstantin Obenland
     * @since	1.5.0 - 19.05.2012
     *
     * @return	void
     */
    function the_bootstrap_comment_nav()
    {
        if (get_comment_pages_count() > 1 and get_option('page_comments')) {
            // are there comments to navigate through
            ?>
	<nav class="comment-nav well">
		<h1 class="assistive-text"><?php 
            _e('Comment navigation', 'the-bootstrap');
            ?>
</h1>
		<div class="nav-previous alignleft"><?php 
            next_comments_link(__('&larr; Newer Comments', 'the-bootstrap'));
            ?>
</div>
		<div class="nav-next alignright"><?php 
            previous_comments_link(__('Older Comments &rarr;', 'the-bootstrap'));
            ?>
</div>
	</nav>
	<?php 
        }
        // check for comment navigation
    }
开发者ID:jimmyshen007,项目名称:webproject,代码行数:31,代码来源:template-tags.php


注:本文中的get_comment_pages_count函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。