>
comment_ID, $args);} ?>
'
',
'email' => '
',
'url' => '
',
);
$fields = apply_filters( 'graphene_comment_form_fields', $fields );
return $fields;
}
/**
* Add some bootstrap grid layout elements
*/
function graphene_bs_grid_row(){ ?> '
',
'submit_button' => ''
);
return array_merge( $defaults, $args );
}
function graphene_comment_clear(){echo '';}
add_filter( 'comment_form_default_fields', 'graphene_comment_form_fields' );
add_filter( 'comment_form_defaults', 'graphene_comment_args', 5 );
add_filter( 'comment_form', 'graphene_comment_clear', 1000 );
if ( ! function_exists( 'graphene_comment_count' ) ) :
/**
* 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;
}
endif;
if ( ! function_exists( 'graphene_get_comment_count' ) ) :
/**
* Adds the functionality to count comments by type, eg. comments, pingbacks, tracbacks. Return the number of comments, but do not print them.
* 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_get_comment_count( $type = 'comments', $only_approved_comments = true, $top_level = false ){
if ( ! get_the_ID() ) return;
if ( $type == 'comments' ) $type_sql = 'comment_type IN ("", "comment")';
elseif ( $type == 'pings' ) $type_sql = 'comment_type IN ("trackback", "pingback")';
elseif ( $type == 'review' ) $type_sql = 'comment_type = "review"';
elseif ( $type == 'trackbacks' ) $type_sql = 'comment_type = "trackback"';
elseif ( $type == 'pingbacks' ) $type_sql = 'comment_type = "pingback"';
$type_sql = apply_filters( 'graphene_comments_typesql', $type_sql, $type );
$approved_sql = $only_approved_comments ? ' AND comment_approved="1"' : '';
$top_level_sql = ( $top_level ) ? ' AND comment_parent="0" ' : '';
global $wpdb;
$query = $wpdb->prepare( 'SELECT COUNT(comment_ID) FROM ' . $wpdb->comments . ' WHERE ' . $type_sql . $approved_sql . $top_level_sql . ' AND comment_post_ID = %d', get_the_ID() );
$result = $wpdb->get_var( $query );
return $result;
}
endif;
if ( ! function_exists( 'graphene_should_show_comments' ) ) :
/**
* Helps to determine if the comments should be shown.
*/
function graphene_should_show_comments() {
global $graphene_settings, $post;
if ( ! isset( $post ) ) return;
if ( $graphene_settings['comments_setting'] == 'disabled_completely' )
return false;
if ( $graphene_settings['comments_setting'] == 'disabled_pages' && get_post_type( $post->ID ) == 'page' )
return false;
if ( ! is_singular() && $graphene_settings['hide_post_commentcount'] )
return false;
if ( ! comments_open() && ! is_singular() && get_comments_number( $post->ID ) == 0 )
return false;
return true;
}
endif;
/**
* Delete and mark spam link for comments. Show only if current user can moderate comments
*/
if ( ! function_exists( 'graphene_moderate_comment' ) ) :
function graphene_moderate_comment( $id ) {
$html = '| ';
$html .= ' ';
$html .= '| |';
if ( current_user_can( 'moderate_comments' ) ) echo $html;
}
endif;
if ( ! function_exists( 'graphene_comments_nav' ) ) :
/**
* Display comments pagination
*
* @package Graphene
* @since 1.9
*/
function graphene_comments_nav(){
global $graphene_settings, $is_paginated;
if ( get_comment_pages_count() > 1 && $is_paginated ) :
?>
display_name, '' , '' );
} else {
$author_link = get_comment_author_link();
}
return apply_filters( 'graphene_comment_author_link', $author_link );
}
endif;
/**
* Comment meta
*/
function graphene_comment_meta( $comment, $args = array(), $depth = 1 ){
global $post;
$meta = array();
/* Avatar */
if ( ! $comment->comment_type || $comment->comment_type == 'comment' ) {
$author_email = $comment->comment_author_email;
$avatar = get_avatar( $author_email, 50 );
$meta['avatar'] = array(
'class' => 'comment-avatar',
'meta' => $avatar . do_action( 'graphene_comment_gravatar', $comment, $args, $depth )
);
}
/* Attributes */
$meta['attr'] = array(
'class' => 'comment-attr',
'meta' => sprintf( __( '%1$s on %2$s at %3$s', 'graphene' ), '', '' )
);
/* Link to comment */
$meta['comment-link'] = array(
'class' => 'single-comment-link',
'meta' => '#'
);
/* Comment by post author */
if ( $comment->user_id === $post->post_author ) {
$meta['attr']['meta'] .= '
' . __( 'Author', 'graphene' ) . '';
}
if ( ! $comment->comment_type || $comment->comment_type == 'comment' ) {
/* Reply link */
$args = array(
'depth' => $depth,
'max_depth' => $args['max_depth'],
'reply_text' => __( 'Reply', 'graphene' ),
);
$comment_reply = get_comment_reply_link( apply_filters( 'graphene_comment_reply_link_args', $args ) );
if ( $comment_reply ) {
$meta['reply'] = array(
'class' => 'comment-reply',
'meta' => $comment_reply
);
}
}
$meta = apply_filters( 'graphene_comment_meta', $meta );
if ( ! $meta ) return;
?>