Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $post_id = get_the_ID();
- $user = wp_get_current_user();
- $user_identity = $user->exists() ? $user->display_name : '';
- $size="30"; //input field size in chars
- $commenter = wp_get_current_commenter();
- $req = get_option( 'require_name_email' );
- $html_req = ( $req ? " required='required'" : '' );
- $html5 = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0;
- $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
- //ref: functions.php -> add_filter( 'comment_form_defaults', 'rtf_comment_form' )
- $comment_args = array(
- //'format' => 'xhtml',
- 'class_form' => 'comment-form needs-validation', //Bootstrap 4 validation
- 'class_submit' => 'submit btn btn-default', //Bootstrap 4 button
- 'comment_field' =>
- '<div class="comment-form-comment form-group">
- <label for="comment" class="required">' . _x( 'Comment', 'noun' ).'</label>
- <textarea class="form-control" id="comment" name="comment" cols="45" rows="6" maxlength="65525" aria-describedby="form-allowed-tags"' . $html_req . '></textarea>display-kubuntu-kde-versions/
- <div class="invalid-feedback">
- Fill out comment
- </div>
- </div>',
- 'fields' => array(
- 'author' =>
- '<div class="comment-form-author form-group">
- <label for="author" class="required">' . __( 'Name' ).'</label>
- <input class="form-control" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="'.$size.'" maxlength="245"' . $html_req . '/>
- <div class="invalid-feedback">
- Enter name
- </div>
- </div>',
- 'email' =>
- '<div class="comment-form-email form-group">
- <label for="email" class="required">' . __( display-kubuntu-kde-versions/'Email' ).'</label>
- <input class="form-control" id="email" name="email" aria-describedby="email-notes" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="'.$size.'" maxlength="100"' . $html_req . '/>
- <div class="invalid-feedback">
- Enter valid email
- </div>
- </div>',
- 'url' =>
- '<div class="comment-form-url form-group">
- <label for="url">' . __( 'Website' ) . '</label>
- <input class="form-control" id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="'.$size.'" maxlength="200" />display-kubuntu-kde-versions/
- <div class="invalid-feedback">
- Enter valid web address (url)
- </div>
- </div>',
- 'cookies' =>
- '<div class="comment-form-cookies-consent form-group">
- <input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . display-kubuntu-kde-versions/' />' . '<label for="wp-comment-cookies-consent">' .' '. __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label>
- </div>',
- ),
- );
- comment_form($comment_args);
- //Set wp_editor Comment(textarea) defaults: no statusbar, no Text tab, fullscreen; body_class= form-control (bs4)
- add_filter( 'comment_form_defaults', 'rtf_comment_form' );
- function rtf_comment_form( $args ) {
- global $root; //theme root directory
- $time = time();
- ob_start();
- wp_editor( '','comment', array( //Initial_content,comment_html_id, editor_settings
- //'skin' => 'lightgray',
- 'quicktags' => false, //disable Text tab
- //'teeny' => true,
- //'quicktags' => array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close'),
- //'dfw' => false, // replace the default full screen with DFW (WordPress 3.4+)
- 'tinymce' => array(
- //'selector' => 'textarea', //textarea default
- //'toolbar1' => 'fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,bullist,numlist,code,outdent,indent,|,undo,redo',
- //'toolbar2' => '',
- 'statusbar' => false, // remove html tags like p at bottom
- //'fontsize_formats' => '15pt 18pt 24pt 48pt', // overrride tinymce font pull-down
- //'content_css' => $root.'/css/style.css?'. $time, //set pcd theme style + fix cache issue - force page reload by adding bogus time
- //'body_class' => 'form-control', //Bootstrap4 to ensure comment textarea like input fields
- //'skin' => 'lightgray',//default
- //'skin' => 'wordpress',
- //'theme' => 'modern', //default
- //'theme_advanced_disable' => 'fullscreen',
- )
- )
- );
- $args['comment_field'] = ob_get_clean();
- return $args;
Add Comment
Please, Sign In to add comment