【问题标题】:wordpress custom comment formwordpress 自定义评论表单
【发布时间】:2012-02-01 11:04:47
【问题描述】:

我有一个问题,我想以评论形式插入,为每个人填写一个 div。 我写了这段代码:

<?php comment_form(
$fields =  array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span                   class="required">*</span>' : '' ) .
            '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '"                      size="30"' . $aria_req . ' /></p><div id="end-contenuto-post"></div>',
'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span                         class="required">*</span>' : '' ) .
            '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '"                 size="30"' . $aria_req . ' /></p>',
'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
            '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '"                        size="30" /></p>',
'title_reply'=>'Lascia un commento',
'comment_notes_before' => '<p class="comment-notes">I campi contrassegnati da  <span class="required">*</span> sono obbligatori</p>',
)); ?>

错误出现在“作者”字段中:

<div id="end-contenuto-post"></div>

这个 html 没有输出……为什么?

【问题讨论】:

    标签: php html forms wordpress field


    【解决方案1】:

    你有没有声明这些变量,

    $commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );
    $aria_req = ( $req ? " aria-required='true'" : '' );
    

    【讨论】:

      【解决方案2】:

      当它告诉您传递一个数组作为参数时,您不要执行 $fields = array(..),而只需使用 array(..) > 或者在 comment_form() 函数之外定义你的数组,然后将其作为参数传递。

      请查看documentation 或this tutorial。

      【讨论】:

      • 我删除了 $field... 但没有输出我的 html.... argghhhh 我阅读了文档但没有显示它.....
      猜你喜欢
      • 2013-07-27
      • 2013-11-27
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多