Guest User

Untitled

a guest
Dec 13th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.20 KB | None | 0 0
  1. function comment_form( $args = array(), $post_id = null ) {
  2.     global $id;
  3.  
  4.     if ( null === $post_id )
  5.         $post_id = $id;
  6.     else
  7.         $id = $post_id;
  8.  
  9.     $commenter = wp_get_current_commenter();
  10.     $user = wp_get_current_user();
  11.     $user_identity = $user->exists() ? $user->display_name : '';
  12.  
  13.     $req = get_option( 'require_name_email' );
  14.     $aria_req = ( $req ? " aria-required='true'" : '' );
  15.     $fields =  array(
  16.         'author' => '<p class="comment-form-author">' . '<label for="author">' . __( '' ) . '</label> ' . ( $req ? '<span class="required"></span>' : '' ) .
  17.                     '<input id="author" name="author" placeholder="Имя*" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
  18.                    
  19.         'email'  => '<p class="comment-form-email"><label for="email">' . __( '' ) . '</label> ' . ( $req ? '<span class="required"></span>' : '' ) .
  20.                     '<input id="email" name="email" placeholder="Email*" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
  21.                    
  22.         'url'    => '<p class="comment-form-url"><label for="url">' . __( '' ) . '</label>' .
  23.                     '<input id="url" name="url" placeholder="Website" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
  24.                    
  25.         'age'    => '<p class="comment-form-age"><label for="age">' . __( '' ) . '</label>' . ( $req ? '<span class="required"></span>' : '' ) .
  26.                     '<input id="age" name="age" placeholder="Возраст*" type="text" value="' . esc_attr( $commenter['comment_author_age'] ) . '" size="30" /></p>',
  27.     );
  28.  
  29.     $required_text = sprintf( ' ' . __(' '), '<span class="required">*</span>' );
  30.     $defaults = array(
  31.         'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
  32.         'comment_field'        => '<p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder="Ваш комментарий..."></textarea></p>',
  33.         'must_log_in'          => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
  34.         '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>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
  35.         'comment_notes_before' => '<p class="comment-notes">' . __( '' ) . ( $req ? $required_text : '' ) . '</p>',
  36.         'comment_notes_after'  => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
  37.         'id_form'              => '',
  38.         'id_submit'            => 'submit',
  39.         'title_reply'          => __( 'Leave a Reply' ),
  40.         'title_reply_to'       => __( 'Leave a Reply to %s' ),
  41.         'cancel_reply_link'    => __( 'Cancel reply' ),
  42.         'label_submit'         => __( 'Post Comment' ),
  43.     );
  44.  
  45.     $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
Add Comment
Please, Sign In to add comment