示例#1
0
/**
 * Localize scripts and add JavaScript data
 *
 * @package Graphene
 * @since 1.9
 */
function graphene_localize_scripts()
{
    global $graphene_settings, $wp_query;
    $posts_per_page = $wp_query->get('posts_per_page');
    $comments_per_page = get_option('comments_per_page');
    $js_object = array('templateUrl' => GRAPHENE_ROOTURI, 'isSingular' => is_singular(), 'shouldShowComments' => graphene_should_show_comments(), 'commentsOrder' => get_option('default_comments_page'), 'sliderDisable' => $graphene_settings['slider_disable'], 'sliderAnimation' => $graphene_settings['slider_animation'], 'sliderTransSpeed' => $graphene_settings['slider_trans_speed'], 'sliderInterval' => $graphene_settings['slider_speed'], 'sliderDisplay' => $graphene_settings['slider_display_style'], 'infScroll' => $graphene_settings['inf_scroll_enable'], 'infScrollClick' => $graphene_settings['inf_scroll_click'], 'infScrollComments' => $graphene_settings['inf_scroll_comments'], 'totalPosts' => $wp_query->found_posts, 'postsPerPage' => $posts_per_page, 'isPageNavi' => function_exists('wp_pagenavi'), 'infScrollMsgText' => sprintf(__('Fetching %1$s more item from %2$s left ...', 'graphene'), 'window.grapheneInfScrollItemsPerPage', 'window.grapheneInfScrollItemsLeft'), 'infScrollMsgTextPlural' => sprintf(_n('Fetching %1$s more item from %2$s left ...', 'Fetching %1$s more items from %2$s left ...', $posts_per_page, 'graphene'), 'window.grapheneInfScrollItemsPerPage', 'window.grapheneInfScrollItemsLeft'), 'infScrollFinishedText' => __('No more items to fetch', 'graphene'), 'commentsPerPage' => $comments_per_page, 'totalComments' => graphene_get_comment_count('comments', true, true), 'infScrollCommentsMsg' => sprintf(__('Fetching %1$s more top level comment from %2$s left ...', 'graphene'), 'window.grapheneInfScrollCommentsPerPage', 'window.grapheneInfScrollCommentsLeft'), 'infScrollCommentsMsgPlural' => sprintf(_n('Fetching %1$s more top level comment from %2$s left ...', 'Fetching %1$s more top level comments from %2$s left ...', $comments_per_page, 'graphene'), 'window.grapheneInfScrollCommentsPerPage', 'window.grapheneInfScrollCommentsLeft'), 'infScrollCommentsFinishedMsg' => __('No more comments to fetch', 'graphene'));
    wp_localize_script('graphene-js', 'grapheneJS', apply_filters('graphene_js_object', $js_object));
}
示例#2
0
 /**
  * Adds the functionality to count comments by type, eg. comments, pingbacks, tracbacks.
  * Based on the code at WPCanyon (http://wpcanyon.com/tipsandtricks/get-separate-count-for-comments-trackbacks-and-pingbacks-in-wordpress/)
  * 
  * In Graphene version 1.3 the $noneText param has been removed
  *
  * @package Graphene
  * @since Graphene 1.3
 */
 function graphene_comment_count($type = 'comments', $oneText = '', $moreText = '')
 {
     $result = graphene_get_comment_count($type);
     if ($result == 1) {
         return str_replace('%', $result, $oneText);
     } elseif ($result > 1) {
         return str_replace('%', $result, $moreText);
     } else {
         return false;
     }
 }
示例#3
0
<?php 
do_action('graphene_before_comment_template');
?>

<?php 
/* Lists all the comments for the current post */
if (have_comments()) {
    ?>

<?php 
    /* Get the comments and pings count */
    global $graphene_tabbed_comment;
    $comments_num = graphene_get_comment_count();
    // to also show comments awaiting approval
    $allcomments_num = graphene_get_comment_count('comments', false);
    $pings_num = graphene_get_comment_count('pings');
    if ($comments_num) {
        $comment_count = sprintf(_n('%s comment', '%s comments', $comments_num, 'graphene'), number_format_i18n($comments_num));
    }
    if ($pings_num) {
        $ping_count = sprintf(_n('%s ping', '%s pings', $pings_num, 'graphene'), number_format_i18n($pings_num));
    }
    $graphene_tabbed_comment = $comments_num && $pings_num ? true : false;
    $class = 'clearfix';
    if (!$comments_num) {
        $class .= ' no-comment';
    }
    if (!$pings_num) {
        $class .= ' no-ping';
    }
    global $is_paginated;