Войти

Показать полную графическую версию : [решено] Как убрать в комментариях поле «сайт» в wordpress?


anfis_chekhov
08-02-2013, 19:19
http://img9.imageshack.us/img9/7152/thumbhpw.jpg (http://img442.imageshack.us/img442/3973/20130208191446.png)
Комментарии (comments.php)
<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
* handled by a callback to graphene_comment which is
* located in the functions.php file.
*
* @package Graphene
* @since Graphene 1.0
*/
global $graphene_settings;
?>

<?php
/* Only show comments depending on the theme setting */
if ( ! graphene_should_show_comments() ) :
return;
endif;
?>

<?php if ( post_password_required() && ( comments_open() || have_comments() ) ) : ?>
<div id="comments">
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'graphene' ); ?></p>

<?php do_action( 'graphene_protected_comment' ); ?>
</div><!-- #comments -->
<?php
/* Stop the rest of comments.php from being processed,
* but don't kill the script entirely -- we still have
* to fully load the template.
*/
return;
endif;
?>

<?php do_action( 'graphene_before_comment_template' ); ?>

<?php /* Lists all the comments for the current post */ ?>
<?php if ( have_comments() ) : ?>

<?php /* Get the comments and pings count */
global $graphene_tabbed_comment;
$comments_num = graphene_get_comment_count();
// to also show comments awaiting approval
$allcomments_num = graphene_get_comment_count( 'comments', false );
$pings_num = graphene_get_comment_count( 'pings' );
if ( $comments_num )
$comment_count = sprintf( _n( '%d comment', '%d comments', $comments_num, 'graphene' ), number_format_i18n( $comments_num ) );
if ( $pings_num )
$ping_count = sprintf( _n( '%d ping', '%d pings', $pings_num, 'graphene' ), number_format_i18n( $pings_num ) );
$graphene_tabbed_comment = ( $comments_num && $pings_num ) ? true : false;

$class = 'clearfix';
if ( ! $comments_num ) $class .= ' no-comment';
if ( ! $pings_num ) $class .= ' no-ping';

$is_paginated = get_option( 'page_comments' );
?>

<div id="comments" class="<?php echo $class; ?>">
<?php if ( $comments_num ) : ?>
<h4 class="comments gutter-left current"><?php if ($graphene_tabbed_comment) {echo '<a href="#">'.$comment_count.'</a>';} else {echo $comment_count;}?></h4>
<?php endif; ?>
<?php if ( $pings_num ) : ?>
<h4 class="pings gutter-left"><?php if ($graphene_tabbed_comment) {echo '<a href="#">'.$ping_count.'</a>';} else {echo $ping_count;}?></h4>
<?php endif; ?>

<?php if ( ( ( $is_paginated && get_option( 'comments_per_page' ) > 3 ) || ! $is_paginated ) && ( $comments_num > 3 || $pings_num > 6 ) ) : ?>
<p class="comment-form-jump"><a href="#respond"><?php _e( 'Skip to comment form', 'graphene' ); ?></a> &darr;</p>
<?php endif; ?>

<?php do_action( 'graphene_before_comments' ); ?>

<?php if ( $comments_num || $allcomments_num ) : ?>
<ol class="clearfix" id="comments_list">
<?php
/* Loop through and list the comments. Tell wp_list_comments()
* to use graphene_comment() to format the comments.
* If you want to overload this in a child theme then you can
* define graphene_comment() and that will be used instead.
* See graphene_comment() in functions.php for more.
*/
$args = array( 'callback' => 'graphene_comment', 'style' => 'ol', 'type' => 'comment' );
wp_list_comments( apply_filters( 'graphene_comments_list_args', $args ) ); ?>

<?php // Are there comments to navigate through? ?>
<?php if ( get_comment_pages_count() > 1 && $is_paginated ) : ?>
<div class="comment-nav clearfix">
<?php if ( function_exists( 'wp_commentnavi' ) ) : ?>
<?php wp_commentnavi(); ?>
<p class="commentnavi-view-all"><?php wp_commentnavi_all_comments_link(); ?></p>
<?php else : ?>
<p><?php paginate_comments_links(); ?>&nbsp;</p>
<?php endif; ?>
<?php do_action( 'graphene_comments_pagination' ); ?>
</div>
<?php endif; // Ends the comment navigation ?>
</ol>
<?php endif; ?>

<?php if ( $pings_num ) : ?>
<ol class="clearfix<?php if (!$comments_num) echo ' display-block'; ?>" id="pings_list">
<?php
/* Loop through and list the pings. Use the same callback function as
* listing comments above, graphene_comment() to format the pings.
*/
$args = array( 'callback' => 'graphene_comment', 'style' => 'ol', 'type' => 'pings', 'per_page' => 0 );
wp_list_comments( apply_filters( 'graphene_pings_list_args', $args ) ); ?>
</ol>
<?php endif; ?>

<?php do_action( 'graphene_after_comments' ); ?>
</div>
<?php endif; // Ends the comment listing ?>


<?php /* Display comments disabled message if there's already comments, but commenting is disabled */ ?>
<?php if ( ! comments_open() && have_comments() ) : ?>
<div id="respond">
<h3 id="reply-title"><?php _e( 'Comments have been disabled.', 'graphene' ); ?></h3>
<?php do_action( 'graphene_comments_disabled' ); ?>
</div>
<?php endif; ?>


<?php /* Display the comment form if comment is open */ ?>
<?php if ( comments_open() ) : ?>

<div id="comment-form-wrap" class="clearfix">
<?php do_action( 'graphene_before_commentform' );

/* Get the comment form. */

$allowedtags = '';
if ( ! $graphene_settings['hide_allowedtags'] ){
$allowedtags .= '<p class="form-allowed-tags">';
$allowedtags .= sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s', 'graphene' ), '<code>' . allowed_tags() . '</code>' );
$allowedtags .= '</p>';
}

$args = array(
'comment_notes_after' => apply_filters( 'graphene_comment_allowedtags', $allowedtags ),
'id_form' => 'commentform',
'label_submit' => __( 'Submit Comment', 'graphene' ),
);
comment_form( apply_filters( 'graphene_comment_form_args', $args ) );

do_action( 'graphene_after_commentform' ); ?>
</div>

<?php endif; // Ends the comment status ?>
Как убрать в комментариях поле «сайт» в wordpress? Что удалить?

Blast
08-02-2013, 19:46
anfis_chekhov, нужно редактировать шаблон includes/theme-comments.php, в оригинальном файле удалить (а лучше закомментировать) строки с 92 по 96 включительно, а именно эту часть:
'url' =>
'<p class="comment-form-url clearfix">
<label for="url" class="graphene_form_label">' . __( 'Website:', 'graphene' ) . ' </label>
<input id="url" name="url" type="text" class="graphene-form-field" value="' . esc_attr( $commenter['comment_author_url'] ) . '" />
</p>',

anfis_chekhov
08-02-2013, 21:13
Спасибо, я оказываеться даже не там искал.
А не подскажите ещё, как выровнить поля «имя»/«e-mail» и «каптча»?
http://img13.imageshack.us/img13/8717/thumbmyzv.jpg (http://img201.imageshack.us/img201/6949/20130208211112.png)

Blast
08-02-2013, 21:17
как выровнить поля »
код?

anfis_chekhov
08-02-2013, 21:26
код? »
includes/theme-comments.php
<?php

/**
* Defines the callback function for use with wp_list_comments(). This function controls
* how comments are displayed.
*/

if (!function_exists( 'graphene_comment' ) ) :

function graphene_comment( $comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( 'clearfix' ); ?>>
<?php do_action( 'graphene_before_comment' ); ?>

<?php /* Added support for comment numbering using Greg's Threaded Comment Numbering plugin */ ?>
<?php if (function_exists( 'gtcn_comment_numbering' ) ) {gtcn_comment_numbering( $comment->comment_ID, $args);} ?>

<div class="comment-wrap clearfix">

<?php if ( $avatar = get_avatar( $comment, apply_filters( 'graphene_gravatar_size', 40) ) ) : ?>
<div class="comment-avatar-wrap">
<?php echo $avatar; ?>
<?php do_action( 'graphene_comment_gravatar' ); ?>
</div>
<?php endif; ?>

<h5 class="comment-author">
<cite><?php comment_author_link(); ?></cite>
<?php do_action( 'graphene_comment_author' ); ?>
</h5>
<div class="comment-meta">
<p class="commentmetadata">
<?php /* translators: %1$s is the comment date, %2$s is the comment time */ ?>
<?php printf( __( '%1$s at %2$s', 'graphene' ), get_comment_date(), get_comment_time() ); ?>
<span class="timezone"><?php echo '(UTC '.get_option( 'gmt_offset' ).')'; ?></span>
<?php edit_comment_link(__( 'Edit comment','graphene' ),' (',') ' ); ?>
<?php if ( function_exists ('graphene_delete_and_spam_comment') ) { graphene_delete_and_spam_comment(get_comment_ID()); } ?>
<span class="comment-permalink"><a href="<?php echo get_comment_link(); ?>"><?php _e( 'Link to this comment', 'graphene' ); ?></a></span>
<?php do_action( 'graphene_comment_metadata' ); ?>
</p>
<p class="comment-reply-link">
<?php comment_reply_link(array( 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __( 'Reply', 'graphene' ) )); ?>

<?php do_action( 'graphene_comment_replylink' ); ?>
</p>

<?php do_action( 'graphene_comment_meta' ); ?>
</div>
<div class="comment-entry">
<?php do_action( 'graphene_before_commententry' ); ?>

<?php if ( $comment->comment_approved == '0' ) : ?>
<p><em><?php _e( 'Your comment is awaiting moderation.', 'graphene' ) ?></em></p>
<?php do_action( 'graphene_comment_moderation' ); ?>
<?php else : ?>
<?php comment_text(); ?>
<?php endif; ?>

<?php do_action( 'graphene_after_commententry' ); ?>
</div>
</div>

<?php do_action( 'graphene_after_comment' ); ?>
<?php

}

endif;


/**
* Customise the comment form
*/
function graphene_comment_form_fields(){

$req = get_option( 'require_name_email' );
$aria_req = ( $req ? ' aria-required="true"' : '' );
$req_mark = ( $req ? ' <span class="required">*</span>' : '' );
$commenter = wp_get_current_commenter();

$fields = array(
'author' =>
'<p class="comment-form-author clearfix">
<label for="author" class="graphene_form_label">' . __( 'Name:', 'graphene' ) . $req_mark . '</label>
<input id="author" name="author" type="text" class="graphene-form-field"' . $aria_req . ' value="' . esc_attr( $commenter['comment_author'] ) . '" />
</p>',
'email' =>
'<p class="comment-form-email clearfix">
<label for="email" class="graphene_form_label">' . __( 'Email:', 'graphene' ) . $req_mark . '</label>
<input id="email" name="email" type="text" class="graphene-form-field"' . $aria_req . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" />
</p>',
);

$fields = apply_filters( 'graphene_comment_form_fields', $fields );

return $fields;
}

// The comment field textarea
function graphene_comment_textarea(){
$html =
'<p class="comment-form-message clearfix">
<label class="graphene_form_label">' . __( 'Message:', 'graphene' ) . ' <span class="required">*</span></label>
<textarea name="comment" id="comment" cols="40" rows="10" class="graphene-form-field" aria-required="true"></textarea>
</p>';
return apply_filters( 'graphene_comment_textarea', $html );
}

// Clear
function graphene_comment_clear(){
echo '<div class="clear"></div>';
}

// Add all the filters we defined
add_filter( 'comment_form_default_fields', 'graphene_comment_form_fields' );
add_filter( 'comment_form_field_comment', 'graphene_comment_textarea' );
add_filter( 'comment_form', 'graphene_comment_clear', 1000 );


/**
* Adds the functionality to count comments by type, eg. comments, pingbacks, tracbacks.
* Based on the code at WPCanyon (http://wpcanyon.com/tipsandtricks/get-separate-count-for-comments-trackbacks-and-pingbacks-in-wordpress/)
*
* In Graphene version 1.3 the $noneText param has been removed
*
* @package Graphene
* @since Graphene 1.3
*/
function graphene_comment_count( $type = 'comments', $oneText = '', $moreText = '' ){

$result = graphene_get_comment_count( $type );

//if( $result == 0):
// echo str_replace( '%', $result, $noneText);
if( $result == 1) :
return str_replace( '%', $result, $oneText);
elseif( $result > 1) :
return str_replace( '%', $result, $moreText);
else :
return false;
endif;
}


/**
* Adds the functionality to count comments by type, eg. comments, pingbacks, tracbacks. Return the number of comments, but do not print them.
* Based on the code at WPCanyon (http://wpcanyon.com/tipsandtricks/get-separate-count-for-comments-trackbacks-and-pingbacks-in-wordpress/)
*
* In Graphene version 1.3 the $noneText param has been removed
*
* @package Graphene
* @since Graphene 1.3
*/
function graphene_get_comment_count( $type = 'comments', $only_approved_comments = true ){
if( $type == 'comments' ) :
$typeSql = 'comment_type = ""';
elseif( $type == 'pings' ) :
$typeSql = 'comment_type != ""';
elseif( $type == 'trackbacks' ) :
$typeSql = 'comment_type = "trackback"';
elseif( $type == 'pingbacks' ) :
$typeSql = 'comment_type = "pingback"';
endif;

$typeSql = apply_filters( 'graphene_comments_typesql', $typeSql, $type );
$approvedSql = $only_approved_comments ? ' AND comment_approved="1"' : '';

global $wpdb;

$result = $wpdb->get_var( '
SELECT
COUNT(comment_ID)
FROM
'.$wpdb->comments.'
WHERE
'.$typeSql.$approvedSql.' AND
comment_post_ID= '.get_the_ID() );

return $result;
}


/**
* Custom jQuery script for the comments/pings tabs
*/
function graphene_tabs_js(){
global $graphene_tabbed_comment;
if ( $graphene_tabbed_comment ) :
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function( $){
$(function(){
// to allow the user to switch tabs
$("div#comments h4.comments a").click(function(){
$("div#comments .comments").addClass( 'current' );
$("div#comments .pings").removeClass( 'current' );
$("div#comments #pings_list").hide();
$("div#comments #comments_list").fadeIn(300);
return false;
});
$("div#comments h4.pings a").click(function(){
$("div#comments .pings").addClass( 'current' );
$("div#comments .comments").removeClass( 'current' );
$("div#comments #comments_list").hide();
$("div#comments #pings_list").fadeIn(300);
return false;
});
});
});
//]]>
</script>
<?php
endif;
}
add_action( 'wp_footer', 'graphene_tabs_js' );


/**
* Helps to determine if the comments should be shown.
*/
if ( ! function_exists( 'graphene_should_show_comments' ) ) :

function graphene_should_show_comments() {
global $graphene_settings, $post;

if ( $graphene_settings['comments_setting'] == 'disabled_completely' )
return false;

if ( $graphene_settings['comments_setting'] == 'disabled_pages' && get_post_type( $post->ID) == 'page' )
return false;

if ( ! is_singular() && $graphene_settings['hide_post_commentcount'] )
return false;

if ( ! comments_open() && have_comments() && ! is_singular() )
return false;

return true;
}

endif;

/**
* Delete and mark spam link for comments. Show only if current user can edit posts
*/
if ( ! function_exists( 'graphene_delete_and_spam_comment' ) ) :
function graphene_delete_and_spam_comment($id) {
if (current_user_can('edit_post')) {
echo '| <a class="comment-delete-link" title="Delete this comment" href="'.get_admin_url().'comment.php?action=cdc&c='.$id.'">Delete</a> ';
echo '| <a class="comment-spam-link" title="Mark this comment as Spam" href="'.get_admin_url().'comment.php?action=cdc&dt=spam&c='.$id.'">Spam</a> |';
}
}
endif;

/**
* Add script to show/hide comment permalink
*/
function graphene_comment_script(){
?>
<script type="text/javascript">
jQuery(document).ready(function($){
/* Comment permalink */
$('li.comment .comment-permalink').hide();
$('.comment-wrap').hover( function(){ $('.comment-permalink', this).fadeIn(200); }, function(){ $('.comment-permalink:eq(0)', this).fadeOut(200); });

/* Jump to comment form */
$('.comment-form-jump a').click(function(){ $('html,body').animate({scrollTop: $("#respond").offset().top - 200},'slow'); return false;});
});
</script>
<?php
}
add_action( 'wp_footer', 'graphene_comment_script' );
?>

Blast
08-02-2013, 21:32
anfis_chekhov, нет, оно там другим шаблоном выводится, возможно comments.php. Вы это плагином подключали? Каким?

anfis_chekhov
08-02-2013, 21:36
Вы это плагином подключали? Каким? »
Да. http://wordpress.org/extend/plugins/captcha/

Blast
08-02-2013, 21:49
В стилях плагина подправьте отступ сверху:

/wp-content/plugins/captcha/css/style.css - в конце

.cptch_block {
direction: ltr;
margin-top:10px;
}

anfis_chekhov
08-02-2013, 22:22
Blast, огромное спасибо.
http://img442.imageshack.us/img442/3375/thumbnqc.jpg (http://img688.imageshack.us/img688/8230/20130208222143.png)
Получилось очень аккуратно.

Blast
08-02-2013, 22:26
Пожалуйста, заходите еще :)

anfis_chekhov
11-02-2013, 23:07
К сожалению, не все прошло так гладко, как хотелось. Теперь после того, как нажимаю «добавить запись»/«обновить запись» встречаю ошибку:
Warning: Cannot modify header information - headers already sent by (output started at /home/u584198117/public_html/wp-content/themes/graphene/includes/theme-comments.php:276) in /home/u584198117/public_html/wp-includes/pluggable.php on line 876
Так же не удается добавить изображение в качестве миниатюры. Я так понимаю, придется делать откат? Жалко...
А если пробую добавить комментарий, то вообще получаю целый коктейль:
Warning: Cannot modify header information - headers already sent by (output started at /home/u584198117/public_html/wp-content/themes/graphene/includes/theme-comments.php:276) in /home/u584198117/public_html/wp-includes/comment.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /home/u584198117/public_html/wp-content/themes/graphene/includes/theme-comments.php:276) in /home/u584198117/public_html/wp-includes/comment.php on line 620

Warning: Cannot modify header information - headers already sent by (output started at /home/u584198117/public_html/wp-content/themes/graphene/includes/theme-comments.php:276) in /home/u584198117/public_html/wp-includes/comment.php on line 621

Warning: Cannot modify header information - headers already sent by (output started at /home/u584198117/public_html/wp-content/themes/graphene/includes/theme-comments.php:276) in /home/u584198117/public_html/wp-includes/pluggable.php on line 876

Habetdin
12-02-2013, 00:52
anfis_chekhov, проблема из-за появления BOM (http://ru.wikipedia.org/wiki/BOM) в отредактированных файлах (например, если использовался, стандартный Блокнот).
Пересохраните измененные вами файлы в кодировке UTF-8 без BOM, например, с помощью AkelPad (http://akelpad.sf.net):
http://i.imgur.com/xNuNc5k.png

anfis_chekhov
13-02-2013, 06:47
Пересохранил, перезолил - проблема не исчезла. :(
http://img443.imageshack.us/img443/6214/thumblhv.jpg (http://img407.imageshack.us/img407/94/20130213064437.png) http://img248.imageshack.us/img248/6430/thumb2qx.jpg (http://img171.imageshack.us/img171/9751/20130213064633.png)

Blast
13-02-2013, 10:07
Еще варианты: Cannot modify header information - headers already sent by - что это такое? (http://cannot-modify-header-information.ru/)

Habetdin
13-02-2013, 14:50
проблема не исчезла »
Файл theme-comments.php тоже пересохранили? =) На втором скрине "жалобы" на него А еще, судя по постам #2-3 его точно редактировали) :cool:

anfis_chekhov
13-02-2013, 17:39
Файл theme-comments.php тоже пересохранили? »
Да и «wp-includes/pluggable.php» для кучи - картина та же. :(

Habetdin
14-02-2013, 20:19
спасибо Вам за помощь »
Пожалуйста!

anfis_chekhov
15-02-2013, 15:58
Проблему решил, дейсвительно, как по ссылке Blastа, были пробелы в «theme-comments.php».
Я, чтобы лишний раз не юзать «FileZilla», делал все махинации через админку с использованием «Notepad ++» (буквально, для поиска нужной строки).
И скорее всего при очередном копипасте допустил такую оплошность.
Habetdin/Blast, спасибо Вам за помощь. :up




© OSzone.net 2001-2012