Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!function_exists('kleo_comment_form')) :
- /**
- * Outputs a complete commenting form for use within a template.
- * Most strings and form fields may be controlled through the $args array passed
- * into the function, while you may also choose to use the comment_form_default_fields
- * filter to modify the array of default fields if you'd just like to add a new
- * one or remove a single field. All fields are also individually passed through
- * a filter of the form comment_form_field_$name where $name is the key used
- * in the array of fields.
- *
- * @param array $args Options for strings, fields etc in the form
- * @param mixed $post_id Post ID to generate the form for, uses the current post if null
- * @return void
- */
- function kleo_comment_form( $args = array(), $post_id = null ) {
- global $id;
- $user = wp_get_current_user();
- $user_identity = $user->exists() ? $user->display_name : '';
- if ( null === $post_id ) {
- $post_id = $id;
- }
- else {
- $id = $post_id;
- }
- if ( comments_open( $post_id ) ) :
- ?>
- <div id="respond-wrap">
- <?php
- $commenter = wp_get_current_commenter();
- $req = get_option( 'require_name_email' );
- $aria_req = ( $req ? " aria-required='true'" : '' );
- $fields = array(
- 'author' => '<div class="row"><p class="comment-form-author col-sm-4"><label for="author">' . __( 'Name', 'kleo_framework' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
- 'email' => '<p class="comment-form-email col-sm-4"><label for="email">' . __( 'Email', 'kleo_framework' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>'
- );
- if (function_exists('bp_is_active')) {
- $profile_link = bp_get_loggedin_user_link();
- }
- else {
- $profile_link = admin_url( 'profile.php' );
- }
- $comments_args = array(
- 'fields' => apply_filters( 'comment_form_default_fields', $fields ),
- 'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'kleo_framework' ), $profile_link, $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
- 'title_reply' => __( 'Leave a reply', 'kleo_framework' ),
- 'title_reply_to' => __( 'Leave a reply to %s', 'kleo_framework' ),
- 'cancel_reply_link' => __( 'Click here to cancel the reply', 'kleo_framework' ),
- 'label_submit' => __( 'Post comment', 'kleo_framework' ),
- 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __( 'Comment', 'kleo_framework' ) . '</label><textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
- 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.', 'kleo_framework' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
- );
- comment_form($comments_args);
- ?>
- </div>
- <?php
- endif;
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment