COMMENT FORM Error: Please type your comment text

Error: Please type your comment text.

I Created COMMENT FORM but Error happened which is above.

I dont know hot to fix this

Anyone help me please

Thank you very much!

Function.php

/** コメント一覧表示部分のコード(CHAPTER 19)*/
function my_comment_list( $comment, $args, $depth ) {
  $GLOBALS['comment'] = $comment; ?
  li ?php comment_class(); ? id=comment-?php comment_ID(); ?
    div class=clearfix
      div class=comment-author clearfix
        ?php echo get_avatar( $comment-comment_author_email, 65 ); ?
        p class=comment-author-name?php comment_author_link(); ?span class=sayssays:/span/p
        p class=comment-metaa href=?php echo esc_url( get_comment_link( $comment-comment_ID ) ) ??php comment_date(); ?
          span?php comment_time(); ?/span/abr /
          ?php edit_comment_link( '(編集)' ); ?
        /p
      /div
      div class=comment-body
        ?php if ( $comment-comment_approved == '0' ) : ?
          pemあなたのコメントは承認待ちです。/em/p
        ?php endif;
        comment_text(); ?
        p class=reply
          ?php comment_reply_link( array_merge( $args, array(
              'reply_text' = '返信',
              'depth' = $depth,
              'max_depth' = $args['max_depth'],
            ) ) ); ?
        /p
      /div
    /div
?php }


/** コメントフォームをカスタマイズ(CHAPTER 20)*/
add_filter( 'comment_form_default_fields', 'comment_form_custom_fields' );

/** お名前、メールアドレス、Webサイト部のマークアップ(CHAPTER 20) */
function comment_form_custom_fields( $fields ) {
  $commenter  = wp_get_current_commenter();
  $req    = get_option( 'require_name_email' );
  $aria_req   = ( $req ?  aria-required='true' : '' );
  /** 名前の項目 */
  $fields['author']   = 'p class=comment-form-authorlabel for=authorお名前/label ' . ( $req ? 'span class=required*/span' : '' ) . 'input id=author name=author type=text value=' . esc_attr( $commenter['comment_author'] ) . ' size=30' . $aria_req . ' //p';
  /** メールアドレスの項目 */
  $fields['email']  = 'p class=comment-form-emaillabel for=emailメールアドレス/label ' . ( $req ? 'span class=required*/span span class=small(メールアドレスは公開されません)/span' : '' ).'input id=email name=email type=text value=' . esc_attr( $commenter['comment_author_email'] ) . ' size=30' . $aria_req . ' //p';
  /**  ウェブサイトの項目 */
  /* $fields['url']   = 'p class=comment-form-urllabel for=urlWebサイト/labelinput id=url name=url type=text value=' . esc_attr( $commenter['comment_author_url'] ) . ' size=30 //p'; */
  $fields['url']    = '';
  return $fields;
}

/** コメントフォームのラベルをカスタマイズ(CHAPTER 20) */
add_filter( 'comment_form_defaults', 'comment_form_custom' );

function comment_form_custom( $form ) {
  global $user_identity, $post;
  $req      = get_option( 'require_name_email' );
  $required_text  = 'span class=required*/span が付いている項目は、必須項目です!';
  /** コメントフォーム textarea */
  $form['comment_field']      =  'p class=comment-form-commentlabel for=commentコメント/labeltextarea id=comment name=comment cols=45 rows=8 aria-required=true/textarea/p';
  /** 要ログイン時 */
  $form['must_log_in']      = 'p class=must-log-in' .  sprintf( 'コメントを残すには、a href=%sログイン/aしてください。', wp_login_url( apply_filters( 'the_permalink', get_permalink( $post-ID ) ) ) ) . '/p';
  /** ログイン時 */
  $form['logged_in_as']       = 'p class=logged-in-as' . sprintf( 'a href=%1$s%2$s/a としてログインしています。a href=%3$s title=Log out of this accountログアウト/aしますか?', admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post-ID ) ) ) ) . '/p';
  /** コメントフォームの前に表示するテキスト */
  $form['comment_notes_before']   = 'p class=comment-notes' . ( $req ? $required_text : '' ) . '/p';
  /** コメントフォームの後ろに表示するテキスト サンプルでは空文字をいれて非表示に */
  /* $form['comment_notes_after'] = 'p class=form-allowed-tags' . sprintf( '次の abbr title=HyperText Markup LanguageHTML/abbr タグと属性を利用できます: %s', ' code' . allowed_tags() . '/code' ) . '/p'; */
  $form['comment_notes_after']  = '';
  /** form要素の id */
  $form['id_form']        = 'commentform';
  /** submit ボタンの id */
  $form['id_submit']        = 'submit';
  /** コメントフォームの見出しのタイトル */
  $form['title_reply']      = 'Leave a Reply';
  /** 返信コメント時のタイトル */
  $form['title_reply_to']     = 'Leave a Reply to %s';
  /** キャンセルリンクのテキスト */
  $form['cancel_reply_link']    = '(or Cancel)';
  /** 送信ボタンのラベル */
  $form['label_submit']       = 'Post Comment';
  return $form;
}

comments.php

?php
/****************************************

    comments.php

    コメント一覧や、コメントフォームを表示するための
    テンプレートファイルです。

    カスタマイズしたcomments.php のコードに関しては、
    CHAPTER 19,20 で詳しく解説しています。

*****************************************/
?
!-- comments.php --
div id=comment-area
    ?php if ( have_comments() ): /** コメントがあったら */ ?
        h3 id=commentsComment/h3
        ?php /** コメント一覧の表示 CHAPTER 19 */
        $args = array(
            'type'      = 'comment',           /** コメントのタイプを comment のみに指定 */
            'callback'  = 'my_comment_list',   /** my_comment_list()関数は、functions.php に記述 */
        ); ?
        ol class=comments-list id=custom-comments
            ?php wp_list_comments( $args ); ?
        /ol
        ?php /** コメントページャーの表示 */
        if ( $wp_query-max_num_comment_pages  1 ) : ?
            div class=comment-page-link
                ?php $args = array(
                    'prev_text' = 'laquo; Prev',
                    'next_text' = 'Next raquo;',
                );
                paginate_comments_links( $args ); ?
            /div
        ?php endif;

        /** ここからピンバックを表示 */
        $str  = 'h3 id=trackbacksTrackback/h3';
        $str .= 'ol class=trackback-list id=custom-trackback';
        $i = 0;
        foreach ( $comments as $comment ) {
            if ( get_comment_type() != 'comment' ) {
                $str .= 'li class=clearfix id=comment-' . get_comment_ID() . '';
                    $str .= 'div class=trackback-author';
                        $str .= 'p class=comment-author-name';
                        $comment_author_url = $comment-comment_author_url;
                        $comment_author = $comment-comment_author;
                        if ( $comment_author_url ) {
                            $str .= 'a href=' . esc_url( $comment_author_url ) . ' target=_blank title=' . esc_attr( $comment_author ) . '';
                            $str .= esc_html( $comment_author );
                            $str .= '/a';
                        } else {
                            $str .= esc_html( $comment_author );
                        }
                        $str .= '/p';
                        $str .= 'p class=comment-meta' . 'a href=' . esc_url( get_comment_link( $comment-comment_ID ) ) . '' . get_comment_date() .'span'. get_comment_time() . '/spana class=edit href=' . get_edit_comment_link() . '(編集)/a/span/p';
                    $str .='/div';
                    $str .= 'div class=trackback-body';
                        if ( $comment-comment_approved == '0' ) {
                            $str .= 'p class=attentionemあなたのトラックバックは承認待ちです。/em/p';
                        }
                        $str .= 'p' . esc_html( get_comment_text() ) . '/p';
                    $str .= '/div';
                $str .= '/li';
                $i++;
            }
        }
        $str .= '/ol';
        if ( $i  0 ) {
            echo $str;
        }   /** ピンバックを表示 ここまで */

    endif; /** if ( have_comments() ): ここまで */
    /** ここからコメントフォーム CHAPTER 20 */
    if (comments_open()):
        comment_form();
    else: ?
        p現在コメントは受け付けておりません。/p
    ?php endif;
    if ( pings_open() ) : ?
        h3 id=trackback-urlTrackback URL/h3
        pinput id=trackback_url readonly=readonly value= ?php trackback_url(true); ? type=text onclick = this.select(); //p
    ?php else : ?
        p現在トラックバックは受け付けておりません。/p
    ?php endif; ?
/div
!-- /comments.php --

Topic comment-form Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.