【问题标题】:Remove boxes from wordpress comments从 wordpress 评论中删除框
【发布时间】:2016-01-28 06:06:53
【问题描述】:

我希望有人可以帮助我或为我指明正确的方向。我现在正在拔头发。

在 wordpress cmets 表单上。我有这些盒子:

Screenshot

我查看了 wordpress 功能页面:https://codex.wordpress.org/Function_Reference/comment_form 其中提到了这个 'comment_notes_before' => '' - 即使我将值设为空白,它仍然会添加那些该死的框!!!!

谁能告诉我如何删除它们?

p.s 我使用的是标准的 comment_form($cmets_args); 实现而不是自定义表单。

谢谢

编辑:完整代码

<?php
  $fields = array(

   // author field
   'author' => '',

   //email field
   'email' => '',

   'comment_notes_before' => '',
   'comment_notes_after' => ''

 );
?>

        <?php

        $comments_args = array(
  'id_form'           => 'commentform',
  'class_form'      => 'comment-form',
  'id_submit'         => 'submit',
  'class_submit'      => 'submit',
  'name_submit'       => 'submit',
  'title_reply'       => __( 'Leave a Reply' ),
  'title_reply_to'    => __( 'Leave a Reply to %s' ),
  'cancel_reply_link' => __( 'Cancel Reply' ),
  'label_submit'      => __( 'Post Comment' ),
  'format'            => 'xhtml',

  'comment_field' =>  '<p class="comment-form-comment"><label for="comment">Comment</label><textarea 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.' ),
      wp_login_url( apply_filters( 'the_permalink', get_permalink() ) )
    ) . '</p>',

  '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( ) ) )
    ) . '</p>',

  'fields' => apply_filters( 'comment_form_default_fields', $fields ),
);
?>

【问题讨论】:

  • 感谢您的回复,但很遗憾没有。我希望 cmets 表单可见我只是不希望评论 textarea 字段上方的那些小框
  • 那些“框”表示用户可以使用哪些标签。这些可以被comment_notes_after 参数抑制(不确定你在哪里得到'comment_notes_before')。此外,我们需要查看您的完整代码,以及您的主题/插件可能会劫持这一事实。
  • 添加了完整的代码。我已经将 _before 和 _after 都设置为 ' '。 ://
  • 我快速浏览了文档,我看不到您删除按钮的位置,如果它与使用 js 添加的文本编辑器相同,但您可以使用 css 和将它们设置为display: none,这将是一个快速的解决方案。

标签: php wordpress


【解决方案1】:

使用 CSS 选择器来设置 cmets 区域的样式绝对是最好的方法,因为没有 WordPress 挂钩来控制这一点。

我快速查看了文档,我看不到您删除按钮的位置,如果它与使用 js 添加的文本编辑器相同,但您可以使用 css 并将它们设置为显示:没有这将是一个快速的解决方案。 – David 2015 年 12 月 16 日 1:18

David 的想法是正确的,而且看起来成功了。在扫描 cmets 之前,我已经掌握了它 - CSS!!!

我正在回答这个问题,所以它不再显示为未回答。

【讨论】:

    猜你喜欢
    • 2011-12-18
    • 2011-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-09
    • 2017-09-08
    • 1970-01-01
    相关资源
    最近更新 更多