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


PHP get_comments_pagenum_link函数代码示例

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


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

示例1: um_rel_canonical_

 function um_rel_canonical_()
 {
     if (!is_singular()) {
         return;
     }
     global $ultimatemember, $wp_the_query;
     if (!($id = $wp_the_query->get_queried_object_id())) {
         return;
     }
     if ($this->core['user'] == $id) {
         $link = $this->get_current_url();
         echo "<link rel='canonical' href='{$link}' />\n";
         return;
     }
     $link = get_permalink($id);
     if ($page = get_query_var('cpage')) {
         $link = get_comments_pagenum_link($page);
     }
     echo "<link rel='canonical' href='{$link}' />\n";
 }
开发者ID:shramee,项目名称:ultimatemember,代码行数:20,代码来源:um-permalinks.php

示例2: canURL_rel_canonical

function canURL_rel_canonical()
{
    if (!is_singular()) {
        return;
    }
    global $wp_the_query;
    if (!($id = $wp_the_query->get_queried_object_id())) {
        return;
    }
    $canonical = get_post_meta($id, 'canonical_URL', TRUE);
    if ($canonical) {
        echo "<link rel='canonical' href='{$canonical}' />\n";
        return;
    }
    $link = get_permalink($id);
    if ($page = get_query_var('cpage')) {
        $link = get_comments_pagenum_link($page);
    }
    echo "<link rel='canonical' href='{$link}' />\n";
}
开发者ID:polhec,项目名称:canonicalURL,代码行数:20,代码来源:canonical.php

示例3: range

    $current = $page;
    $max = 3;
    $end = $pages;
    $range = $current + $max < $end ? range($current, $current + $max) : range($current - ($current + $max - $end), $end);
    $output[] = '<div class="uk-grid tm-grid-block"><div class="uk-width-1-1"><div class="uk-panel uk-panel-space"><ul class="uk-pagination">';
    $range_start = max($page - $max, 1);
    $range_end = min($page + $max - 1, $pages);
    if ($page > 1) {
        $link = $type === 'posts' ? get_pagenum_link($page - 1) : get_comments_pagenum_link($page - 1);
        $output[] = '<li><a href="' . $link . '"><i class="uk-icon-angle-double-left"></i></a></li>';
    }
    for ($i = 1; $i <= $end; $i++) {
        if ($i == 1 || $i == $end || in_array($i, $range)) {
            if ($i == $page) {
                $output[] = '<li class="uk-active"><span>' . $i . '</span></li>';
            } else {
                $link = $type === 'posts' ? get_pagenum_link($i) : get_comments_pagenum_link($i);
                $output[] = '<li><a href="' . $link . '">' . $i . '</a></li>';
            }
        } else {
            $output[] = '#';
        }
    }
    if ($page < $pages) {
        $link = $type === 'posts' ? get_pagenum_link($page + 1) : get_comments_pagenum_link($page + 1);
        $output[] = '<li><a href="' . $link . '"><i class="uk-icon-angle-double-right"></i></a></li>';
    }
    $output[] = '</ul></div></div></div>';
    $output = preg_replace('/>#+</', '><li><span>...</span></li><', implode("", $output));
    echo $output;
}
开发者ID:rbt88,项目名称:1,代码行数:31,代码来源:_pagination.php

示例4: get_comment_pagination

 /**
  * get the comment pagenavi
  * 
  * 
  * @param string $class Class name
  * @param bool $below The position where show.
  * @return string
  * @version 1.0.0
  * 
  */
 public static function get_comment_pagination(array $args = [])
 {
     global $post;
     /**
      * post comment status
      */
     static $page_comments = null, $cpp = null, $thread_comments = null, $max_pages = null;
     if ($page_comments === null) {
         $page_comments = theme_cache::get_option('page_comments');
     }
     /** if comment is closed, return */
     if (!$page_comments) {
         return false;
     }
     /**
      * comments per page
      */
     if (!$cpp === null) {
         $cpp = theme_cache::get_option('comments_per_page');
     }
     /**
      * thread_comments
      */
     if ($thread_comments === null) {
         $thread_comments = get_option('thread_comments');
     }
     if ($max_pages === null) {
         $max_pages = get_comment_pages_count(null, get_option('comments_per_page'), theme_cache::get_option('thread_comments'));
     }
     /** 
      * defaults args
      */
     $defaults = ['classes' => 'comment-pagination', 'cpaged' => max(1, get_query_var('cpage')), 'cpp' => $cpp, 'thread_comments' => $thread_comments ? true : false, 'default_comments_page' => 'oldest', 'max_pages' => $max_pages];
     $r = array_merge($defaults, $args);
     extract($r, EXTR_SKIP);
     /** If has page to show me */
     if ($max_pages > 1) {
         $big = 999;
         $args = array('base' => str_replace($big, '%#%', get_comments_pagenum_link($big)), 'total' => $max_pages, 'current' => $cpaged, 'echo' => false, 'prev_text' => '<i class="fa fa-angle-left"></i>', 'next_text' => '<i class="fa fa-angle-right"></i>');
         $comments_page_links = paginate_links($args);
         /**
          * add data-* attribute
          */
         $comments_page_links = str_replace(' href=', ' data-post-id="' . $post->ID . '" data-cpage="' . $cpaged . '" href=', $comments_page_links);
         return '<div class="' . $classes . '">' . $comments_page_links . '</div>';
     }
 }
开发者ID:ClayMoreBoy,项目名称:mx,代码行数:57,代码来源:functions.php

示例5: get_previous_comments_link

function get_previous_comments_link($label = '')
{
    return '<a href="' . esc_url(get_comments_pagenum_link($prevpage)) . '" ' . apply_filters('previous_comments_link_attributes', '') . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
}
开发者ID:basdog22,项目名称:Qool,代码行数:4,代码来源:layer.php

示例6: get_page_url

 /**
  * Get the URL to a certain page.
  *
  * @param int $page_number The page number.
  * @param string $old_url Optional. The URL to add the page number to.
  * @return string $url The URL to the page number.
  */
 public function get_page_url($page_number, $old_url = '')
 {
     return get_comments_pagenum_link($page_number + 1);
 }
开发者ID:2createstudio,项目名称:carbon-pagination,代码行数:11,代码来源:Carbon_Pagination_Comments.php

示例7: get_previous_comments_link

/**
 * Return the previous comments page link.
 *
 * @since 2.7.1
 *
 * @param string $label Optional. Label for comments link text.
 * @return string|null
 */
function get_previous_comments_link($label = '')
{
    if (!is_singular() || !get_option('page_comments')) {
        return;
    }
    $page = get_query_var('cpage');
    if (intval($page) <= 1) {
        return;
    }
    $prevpage = intval($page) - 1;
    if (empty($label)) {
        $label = __('&laquo; Older Comments');
    }
    return '<a href="' . esc_url(get_comments_pagenum_link($prevpage)) . '" ' . apply_filters('previous_comments_link_attributes', '') . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
}
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:23,代码来源:link-template.php

示例8: rel_canonical

/**
 * Output rel=canonical for singular queries.
 *
 * @since 2.9.0
*/
function rel_canonical()
{
    if (!is_singular()) {
        return;
    }
    if (!($id = get_queried_object_id())) {
        return;
    }
    $url = get_permalink($id);
    $page = get_query_var('page');
    if ($page) {
        $url = trailingslashit($url) . user_trailingslashit($page, 'single_paged');
    }
    $cpage = get_query_var('cpage');
    if ($cpage) {
        $url = get_comments_pagenum_link($cpage);
    }
    echo '<link rel="canonical" href="' . esc_url($url) . "\" />\n";
}
开发者ID:gigikiri,项目名称:WordPress,代码行数:24,代码来源:link-template.php

示例9: generate_canonical

 /**
  * This is a function for generating canonical tag
  * @author Howard R <howard@realtyna.com>
  * @static
  * @global object $wp_the_query WordPress Query object
  * @return void
  */
 public static function generate_canonical()
 {
     /** Original WordPress code **/
     if (!is_singular()) {
         return;
     }
     global $wp_the_query;
     if (!($id = $wp_the_query->get_queried_object_id())) {
         return;
     }
     /** WPL canonical **/
     if (self::$canonical) {
         echo PHP_EOL;
         echo '<link rel="canonical" href="' . self::$canonical . '" />';
         return;
     }
     /** Original WordPress code **/
     $link = get_permalink($id);
     if ($page = get_query_var('cpage')) {
         $link = get_comments_pagenum_link($page);
     }
     echo PHP_EOL;
     echo '<link rel="canonical" href="' . $link . '" />';
 }
开发者ID:gvh1993,项目名称:project-vvvh,代码行数:31,代码来源:html.php

示例10: wp_commentnavi

function wp_commentnavi($before = '', $after = '')
{
    global $wp_query;
    $comments_per_page = intval(get_query_var('comments_per_page'));
    $paged = intval(get_query_var('cpage'));
    $commentnavi_options = get_option('commentnavi_options');
    $numcomments = intval($wp_query->comment_count);
    $max_page = intval($wp_query->max_num_comment_pages);
    if (empty($paged) || $paged == 0) {
        $paged = 1;
    }
    $pages_to_show = intval($commentnavi_options['num_pages']);
    $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;
    }
    if ($max_page > 1 || intval($commentnavi_options['always_show']) == 1) {
        $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $commentnavi_options['pages_text']);
        $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
        echo $before . '<div class="wp-commentnavi">' . "\n";
        switch (intval($commentnavi_options['style'])) {
            case 1:
                if (!empty($pages_text)) {
                    echo '<span class="pages">' . $pages_text . '</span>';
                }
                if ($start_page >= 2 && $pages_to_show < $max_page) {
                    $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['first_text']);
                    echo '<a href="' . esc_url(get_comments_pagenum_link()) . '" class="first" title="' . $first_page_text . '">' . $first_page_text . '</a>';
                    if (!empty($commentnavi_options['dotleft_text'])) {
                        echo '<span class="extend">' . $commentnavi_options['dotleft_text'] . '</span>';
                    }
                }
                previous_comments_link($commentnavi_options['prev_text']);
                for ($i = $start_page; $i <= $end_page; $i++) {
                    if ($i == $paged) {
                        $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']);
                        echo '<span class="current">' . $current_page_text . '</span>';
                    } else {
                        $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']);
                        echo '<a href="' . esc_url(get_comments_pagenum_link($i)) . '" class="page" title="' . $page_text . '">' . $page_text . '</a>';
                    }
                }
                next_comments_link($commentnavi_options['next_text'], $max_page);
                if ($end_page < $max_page) {
                    if (!empty($commentnavi_options['dotright_text'])) {
                        echo '<span class="extend">' . $commentnavi_options['dotright_text'] . '</span>';
                    }
                    $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['last_text']);
                    echo '<a href="' . esc_url(get_comments_pagenum_link($max_page)) . '" class="last" title="' . $last_page_text . '">' . $last_page_text . '</a>';
                }
                break;
            case 2:
                echo '<form action="' . admin_url('admin.php?page=' . plugin_basename(__FILE__)) . '" method="get">' . "\n";
                echo '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">' . "\n";
                for ($i = 1; $i <= $max_page; $i++) {
                    $page_num = $i;
                    if ($page_num == 1) {
                        $page_num = 0;
                    }
                    if ($i == $paged) {
                        $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']);
                        echo '<option value="' . esc_url(get_comments_pagenum_link($page_num)) . '" selected="selected" class="current">' . $current_page_text . "</option>\n";
                    } else {
                        $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']);
                        echo '<option value="' . esc_url(get_comments_pagenum_link($page_num)) . '">' . $page_text . "</option>\n";
                    }
                }
                echo "</select>\n";
                echo "</form>\n";
                break;
        }
        echo '</div>' . $after . "\n";
    }
}
开发者ID:Dj15,项目名称:wp-commentnavi,代码行数:88,代码来源:wp-commentnavi.php

示例11: array

            echo $current + $x + 1;
            ?>
</a></li>
<?php 
        }
    }
    /**
     * Next Link
     */
    // anchor classes and target
    $classes = array('copy', 'next');
    $params = $get;
    $params[$key] = $current + 1;
    if ($current === $pages) {
        array_push($classes, 'disabled');
    }
    $href = get_comments_pagenum_link($current + 1);
    ?>
    <li class="<?php 
    echo implode(' ', $classes);
    ?>
"><a href="<?php 
    echo $href;
    ?>
"><?php 
    echo $next;
    ?>
</a></li>
</ul>
<?php 
}
开发者ID:silviulucian,项目名称:PHP-Pagination,代码行数:31,代码来源:wp_comments.php

示例12: basey_pagination

/**
 * Pagination for various lists
 * @param  string $type
 * @return html
 * @source http://yootheme.com (Warp Themes)
 */
function basey_pagination($type = 'posts')
{
    global $wp_query, $post, $wpdb;
    if ($type === 'comments' && !get_option('page_comments')) {
        return;
    }
    if (!isset($page) && !isset($pages)) {
        if ($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 {
            $comments = $wpdb->get_var("\n\t\t\t\tSELECT COUNT(*)\n\t\t\t\tFROM {$wpdb->comments}\n\t\t\t\tWHERE comment_approved = '1'\n\t\t\t\tAND comment_parent = '0'\n\t\t\t\tAND comment_post_ID = {$post->ID}");
            $page = get_query_var('cpage');
            $comments_per_page = get_option('comments_per_page');
            $pages = intval(ceil($comments / $comments_per_page));
        }
        $page = !empty($page) ? intval($page) : 1;
    }
    $output = array();
    if ($pages > 1) {
        $current = $page;
        $max = 3;
        $end = $pages;
        $range = $current + $max < $end ? range($current, $current + $max) : range($current - ($current + $max - $end), $end);
        $output[] = '<ul class="uk-pagination">';
        $range_start = max($page - $max, 1);
        $range_end = min($page + $max - 1, $pages);
        if ($page > 1) {
            $link = $type === 'posts' ? get_pagenum_link($page - 1) : get_comments_pagenum_link($page - 1);
            $output[] = '<li><a href="' . $link . '"><i class="uk-icon-angle-double-left"></i></a></li>';
        }
        for ($i = 1; $i <= $end; $i++) {
            if ($i == 1 || $i == $end || in_array($i, $range)) {
                if ($i == $page) {
                    $output[] = '<li class="uk-active"><span>' . $i . '</span></li>';
                } else {
                    $link = $type === 'posts' ? get_pagenum_link($i) : get_comments_pagenum_link($i);
                    $output[] = '<li><a href="' . $link . '">' . $i . '</a></li>';
                }
            } else {
                $output[] = '#';
            }
        }
        if ($page < $pages) {
            $link = $type === 'posts' ? get_pagenum_link($page + 1) : get_comments_pagenum_link($page + 1);
            $output[] = '<li><a href="' . $link . '"><i class="uk-icon-angle-double-right"></i></a></li>';
        }
        $output[] = '</ul>';
        $output = preg_replace('/>#+</', '><li><span>...</span></li><', implode("", $output));
        echo $output;
    }
}
开发者ID:kokokokokokoko,项目名称:basey-theme,代码行数:59,代码来源:functions.php

示例13: vpt_rel_canonical

 /**
  * overrides the WP rel_canonical - use the correct canonical tags for virtual pages
  *
  */
 public function vpt_rel_canonical()
 {
     if (!is_singular()) {
         return;
     }
     global $wp_the_query;
     if (!($id = $wp_the_query->get_queried_object_id())) {
         return;
     }
     if ($this->is_virtual_page() && $id == $this->template->ID) {
         global $wp_rewrite;
         $link = $wp_rewrite->get_page_permastruct();
         $link = str_replace('%pagename%', get_page_uri($GLOBALS['post']), $link);
         $link = home_url($link);
         $revvurl = strrev($this->options['virtualpageurl']);
         $revlink = strrev($link);
         if ($revvurl) {
             // add slash if the custom permalink has slash
             if ($revvurl[0] == '/' && $revlink[0] != '/') {
                 $link = $link . '/';
             } elseif ($revvurl[0] != '/' && $revlink[0] == '/') {
                 $link = substr($link, 0, -1);
             }
         }
         //$link = user_trailingslashit($link, $GLOBALS['post']->post_type);
     } else {
         $link = get_permalink($id);
     }
     if ($page = get_query_var('cpage')) {
         $link = get_comments_pagenum_link($page);
     }
     echo "<link rel='canonical' href='{$link}' />\n";
 }
开发者ID:aileenpiagola,项目名称:virtual-pages-with-templates,代码行数:37,代码来源:virtualpages-with-templates.php

示例14: return_next_comments_link

/**
 * Return Next Comments Link
 *
 * @param TimberPost $post
 * @param string $label
 * @param integer $max_page
 * @global integer $cpage
 * @return string
 */
function return_next_comments_link($post, $label = '', $max_page = 0)
{
    global $cpage;
    if (!is_singular() || !get_option('page_comments')) {
        return;
    }
    $commentsPerPage = (int) get_option('comments_per_page');
    $nextpage = intval($cpage) + 1;
    if (empty($max_page)) {
        $max_page = get_comment_pages_count($post->comments, $commentsPerPage);
    }
    if ($nextpage > $max_page) {
        return;
    }
    if (empty($label)) {
        $label = __('Newer Comments &raquo;');
    }
    /**
     * Filter the anchor tag attributes for the next comments page link.
     *
     * @since 2.7.0
     *
     * @param string $attributes Attributes for the anchor tag.
     */
    return '<a href="' . esc_url(get_comments_pagenum_link($nextpage)) . '" ' . apply_filters('next_comments_link_attributes', '') . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
}
开发者ID:mindgruve,项目名称:mg-press,代码行数:35,代码来源:comments.php

示例15: get_the_comments_pagination

 /**
  * Returns comments pagination
  * @author Eric Wennerberg
  * @since 0.0.4
  * @version 0.1.1
  * @param array $args
  * @uses $this->helpers_pagination
  * @return str comments pagination markup
  */
 function get_the_comments_pagination($args = array())
 {
     $default = array('base' => str_replace(99999, '%#%', esc_url(get_comments_pagenum_link(99999))), 'format' => '?paged=%#%', 'type' => 'array', 'prev_text' => '<', 'next_text' => '>', 'end_size' => 0, 'mid_size' => 2, 'echo' => false, 'current_class' => '');
     $opt = array_merge($default, $args);
     $return = $this->helpers_pagination(paginate_comments_links($opt), $opt['current_class']);
     return $return;
 }
开发者ID:jun200,项目名称:wordpress,代码行数:16,代码来源:class-flavour-templates.php


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