Hi guys
I'm in way over my head here and have absolutely no idea how to fix this or why it's even there. I have a wordpress website and after comments were turned off in the posts page, I now receive an error where the comments box used to be.
This is the error I'm receiving:
Warning: call_user_func() expects parameter 1 to be a valid callback, function 'custom_comment' not found or invalid function name in /home/website/public_html/wp-includes/comment-template.php on line 1335
Now I have found 2 files, the comment-template.php (Like listed in the error) and the theme-comments.php file.
I have found the theme-comments.php file has a function called custom_comment. Which I believe is what is causing the problem going by the error. I changed the function name in the comment-template.php file to custom_comment and the error went away. But the function isnt working properly at all now. Regardless of whether I turn comments on or off it display "One response for this post".
Here is the code on the comment-template.php line 1335:
function start_el( &$output, $comment, $depth, $args, $id = 0 ) {
$depth++;
$GLOBALS['comment_depth'] = $depth;
$GLOBALS['comment'] = $comment;
if ( !empty($args['callback']) ) {
call_user_func($args['callback'], $comment, $args, $depth);
return;
}
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
<?php if ( 'div' != $args['style'] ) : ?>
<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
<?php endif; ?>
<div class="comment-author vcard">
<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
<br />
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php
/* translators: 1: date, 2: time */
printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','' );
?>
</div>
<?php comment_text() ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
<?php if ( 'div' != $args['style'] ) : ?>
</div>
<?php endif; ?>
Here is some of the code on the theme-comments.php file:
<?php
// Fist full of comments
function custom_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<a name="comment-<?php comment_ID() ?>"></a>
<div id="li-comment-<?php comment_ID() ?>" class="comment-container">
<?php if(get_comment_type() == "comment"){ ?>
<div class="avatar"><?php the_commenter_avatar($args) ?></div>
<?php } ?>
<div class="comment-head">
<span class="name"><?php the_commenter_link() ?></span>
<span class="date"><?php echo get_comment_date($GLOBALS['storefrontdate']) ?> <?php _e('at', 'storefrontthemes'); ?> <?php echo get_comment_time(); ?></span>
<span class="perma"><a href="<?php echo get_comment_link(); ?>" title="<?php _e('Direct link to this comment', 'storefrontthemes'); ?>">#</a></span>
<span class="edit"><?php edit_comment_link('Edit', '', ''); ?></span>
</div><!-- /.comment-head -->
<div class="comment-entry" id="comment-<?php comment_ID(); ?>">
<?php comment_text() ?>
<?php if ($comment->comment_approved == '0') { ?>
<p class='unapproved'><?php _e('Your comment is awaiting moderation.', 'storefrontthemes'); ?></p>
<?php } ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div><!-- /.reply -->
</div><!-- /comment-entry -->
</div><!-- /.comment-container -->
<?php
}
// PINGBACK / TRACKBACK OUTPUT
function list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li id="comment-<?php comment_ID(); ?>">
<span class="author"><?php comment_author_link(); ?></span> -
<span class="date"><?php echo get_comment_date($GLOBALS['storefrontdate']) ?></span>
<span class="pingcontent"><?php comment_text() ?></span>
<?php
}
function the_commenter_link() {
$commenter = get_comment_author_link();
if ( ereg( ']* class=[^>]+>', $commenter ) ) {$commenter = ereg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter );
} else { $commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter );}
echo $commenter ;
}
function the_commenter_avatar($args) {
$email = get_comment_author_email();
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( "$email", $args['avatar_size']) );
echo $avatar;
}
I have no idea what is happening and why this isnt working so if someone could please help me out, i'd so appreciate it!!