>
'comment-attr',
'meta' => sprintf( __( '%1$s on %2$s at %3$s', 'franz-josef' ), '', '' )
);
if ( $comment->user_id === $post->post_author ) {
$meta['author'] = array(
'class' => 'author-cred label',
'meta' => __( 'Author', 'franz-josef' ),
);
}
$meta = apply_filters( 'franz_comment_meta', $meta );
if ( ! $meta ) return;
?>
'
',
'email' => '
',
'url' => '
',
);
$fields = apply_filters( 'franz_comment_form_fields', $fields );
return $fields;
}
/**
* Add some bootstrap grid layout elements
*/
function franz_bs_grid_row(){ ?> '
',
);
return array_merge( $defaults, $args );
}
function franz_comment_clear(){echo '';}
add_filter( 'comment_form_default_fields', 'franz_comment_form_fields' );
add_filter( 'comment_form_defaults', 'franz_comment_args', 5 );
add_filter( 'comment_form', 'franz_comment_clear', 1000 );
/**
* Modify the comment submit button
*/
function franz_comment_id_fields( $result, $id, $replytoid ){
ob_start();
?>
1 )
return str_replace( '%', $result, $moreText );
else
return false;
}
endif;
if ( ! function_exists( 'franz_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/)
*
*/
function franz_get_comment_count( $type = 'comments', $only_approved_comments = true, $top_level = false ){
if ( ! get_the_ID() ) return;
if ( $type == 'comments' ) $type_sql = 'comment_type = ""';
elseif ( $type == 'pings' ) $type_sql = 'comment_type != ""';
elseif ( $type == 'trackbacks' ) $type_sql = 'comment_type = "trackback"';
elseif ( $type == 'pingbacks' ) $type_sql = 'comment_type = "pingback"';
$type_sql = apply_filters( 'franz_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( 'franz_should_show_comments' ) ) :
/**
* Helps to determine if the comments should be shown.
*/
function franz_should_show_comments( $post_id = '' ) {
global $franz_settings, $post;
if ( ! $post_id && ! isset( $post ) ) return;
if ( ! $post_id ) $post_id = $post->ID;
if ( $franz_settings['comments_setting'] == 'disabled_completely' ) return false;
if ( $franz_settings['comments_setting'] == 'disabled_pages' && get_post_type( $post_id ) == 'page' ) return false;
if ( ! comments_open( $post_id ) ) return false;
if ( ! comments_open() && ! is_singular() && get_comments_number( $post_id ) == 0 ) return false;
return true;
}
endif;
if ( ! function_exists( 'franz_moderate_comment' ) ) :
/**
* Delete and mark spam link for comments. Show only if current user can moderate comments
*/
function franz_moderate_comment( $id ) {
$html = '| ';
$html .= ' ';
$html .= '| |';
if ( current_user_can( 'moderate_comments' ) ) echo $html;
}
endif;
if ( ! function_exists( 'franz_comment_author_link' ) ) :
/**
* Display comment author's display name if author is registered
*
*/
function franz_comment_author_link( $user_id ){
if ( $user_id ) {
$author = get_userdata( $user_id );
$author_link = get_comment_author_url_link( $author->display_name, '' , '' );
} else {
$author_link = get_comment_author_link();
}
return apply_filters( 'franz_comment_author_link', $author_link );
}
endif;