2010-08-01 62 views

回答

4

評論表由comment_form() function控制。您有2種選擇,如果你想改變它的輸出:

  1. 更改$fields說法,當你把它刪除comment_author_url
  2. 在主題的functions.php中過濾功能的輸出。

場爭論

$your_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>', 
    '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>', 
); 
comment_form(array('fields' => $your_fields)); 

過濾

function your_comment_form_fields($the_form_fields){ 
    // code to remove the author field from $the_form_fields 
    return $the_form_fields; 
} 
add_filter('comment_form_default_fields', 'your_comment_form_fields'); 
0

我使用Starkers爲好,而無法通過傳遞沒有「URL」鍵或在田間地頭參數空「URL」鍵刪除網站領域。這是因爲Starkers在functions.php中使用自己的自定義函數來將過濾器應用於comment_form_default_fields。檢查通過修改評論表單:

function starkers_fields($fields) 

它是這樣做的:

add_filter('comment_form_default_fields','starkers_fields'); 

現在我可以更容易樣式標籤和星號要求,以及。所需的星號沒有包裝元素,這使得對齊樣式成爲一個問題。

2

進入的wp-content \主題\瀰漫\文件的comments.php

滿布是我的主題名稱,你應該去你們各自的主題文件夾

發現這個代碼塊

comment_form(apply_filters('suffusion_comment_form_fields', array(
     'fields' => array(
      'author' => $author_field, 
      'email' => $email_field, 
     // 'url' => $url_field, // comment this field 
     ), 

只是評論url字段。它是在我的情況下工作。

您可以檢查site參考

0

請在主題functions.php

function crunchify_disable_comment_url($fields) { 
unset($fields['url']); 
return $fields; 
} 
add_filter('comment_form_default_fields','crunchify_disable_comment_url');