'ol', 'type' => 'all', 'callback' => 'framework_comments_callback', 'end-callback' => 'framework_comments_end_callback' ); /* Return the arguments and allow devs to overwrite them. */ return apply_atomic( 'list_comments_args', $args ); } /* Uses the $comment_type to determine which comment template should be used. */ function framework_comments_callback( $comment, $args, $depth ) { global $framework; $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; /* Get the comment type of the current comment. */ $comment_type = get_comment_type( $comment->comment_ID ); /* Create an empty array if the comment template array is not set. */ if ( !isset( $framework->comment_template) || !is_array( $framework->comment_template ) ) $framework->comment_template = array(); /* Check if a template has been provided for the specific comment type. If not, get the template. */ if ( !isset( $framework->comment_template[$comment_type] ) ) { /* Create an array of template files to look for. */ $templates = array( "comment-{$comment_type}.php" ); /* If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. */ if ( 'pingback' == $comment_type || 'trackback' == $comment_type ) $templates[] = 'comment-ping.php'; /* Add the fallback 'comment.php' template. */ $templates[] = 'comment.php'; /* Locate the comment template. */ $template = locate_template( $templates ); /* Set the template in the comment template array. */ $framework->comment_template[$comment_type] = $template; } /* If a template was found, load the template. */ if ( !empty( $framework->comment_template[$comment_type] ) ) require( $framework->comment_template[$comment_type] ); } /* Ends the display of individual comments. */ function framework_comments_end_callback() { echo ''; } /* Filters the WordPress comment_form() function that was added in WordPress 3.0. */ function framework_comment_form_args( $args ) { global $user_identity; /* Get the current commenter. */ $commenter = wp_get_current_commenter(); /* Create the required and element class. */ $req = ( ( get_option( 'require_name_email' ) ) ? ' ' . __( 'Required', 'wordsmith' ) . '' : '' ); $input_class = ( ( get_option( 'require_name_email' ) ) ? ' req' : '' ); /* Sets up the default comment form fields. */ $fields = array( 'author' => '

', 'email' => '

', 'url' => '

' ); /* Sets the default arguments for displaying the comment form. */ $args = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'comment_field' => '

', 'must_log_in' => '

' . sprintf( __( 'You must be logged in to post a comment.', 'wordsmith' ), wp_login_url( get_permalink() ) ) . '

', 'logged_in_as' => '

' . sprintf( __( 'Logged in as %2$s', 'wordsmith' ), admin_url( 'profile.php' ), esc_attr( $user_identity ) ) . ' ' . __( 'Sign Out', 'wordsmith' ) . '

', 'comment_notes_before' => '', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => '' . __( 'Leave a Reply', 'wordsmith' ) . '', 'title_reply_to' => '' . __( 'Leave a Reply to %s', 'wordsmith' ) . '', 'cancel_reply_link' => __( 'Cancel', 'wordsmith' ), 'label_submit' => __( 'Post Comment', 'wordsmith' ), ); /* Return the arguments for displaying the comment form. */ return $args; } ?>