WordPress.org

Ready to get started?Download WordPress

Forums

Comments callback error (8 posts)

  1. tjphop
    Member
    Posted 3 years ago #

    Hello everyone.

    I am creating my first WordPress theme. I have added the loop to my index.php and the posts are displaying as they should. However, the comments are not. The number of comments, the link to post a comment and the comment form display as they should, but when you submit a comment I get this error:

    Warning: call_user_func(twentyeleven_comment) [function.call-user-func]: First argument is expected to be a valid callback in /home/berrycon/public_html/sandbox/wp-includes/comment-template.php on line 1334

    in place of where the comments should show up.

    The test site is at http://berryconcept.co.uk/sandbox

    The WP code on my index page is as follow:

    <?php global $query_string; // required
    $posts = query_posts($query_string.'&posts_per_page=3'); // shows only three posts ?>
    
    <!--Start the default loop-->
    
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <!-- The following tests if the current post is in category 3. -->
     <!-- If it is, the div box is given the CSS class "post-cat-three". -->
     <!-- Otherwise, the div box will be given the CSS class "post". -->
     <?php if ( in_category('special') ) { ?>
               <div class="post_special">
     <?php } else { ?>
    
             <div <?php post_class() ?> id="post-<?php the_ID();?>">
     <?php } ?>
    <div class="det">
    <h1 class="title"><a href="<?php the_permalink()?>"<rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
     <!-- Display the Title as a link to the Post's permalink. -->
    <h2 class="author">by <?php the_author_posts_link() ?></h3>
    	<div class="date">
         <h1 class="day"><?php the_time ('d')?></h1>
       	 <h2 class="month_year"><?php the_time('M / y')?> </h2>
    	</div><!--end date-->
    </div><!--end det-->
    
     <!-- Display the Post's content (before more tag) in a div box. -->
     <div class="entry"> <?php the_content('<span class="moretext">(more)</span>'); ?>
     <!-- Display a comma separated list of the Post's Categories. -->
    <p class="postmetadata">
    Posted in <?php the_category(',') ?>
    <strong>|</strong>
     <?php edit_post_link('Edit','','<strong>|</strong>'); ?>
    </div> <!-- closes entry --> 
    
    <div id="pagecomments">
    <?php comments_template();?>
    </div>
    
    <div class=comments">
    <?php comments_popup_link('There are no comments, please add your thoughts ', 'There is 1 comment, please add your thoughts ', 'There are % comments, please add your thoughts '); ?></p>
    </div>
    
    </div><!--closes post or special-->
    
     <!-- Stop The Loop (but note the "else:" - see next line). -->
     <?php endwhile; else: ?>
    
     <!-- The very first "if" tested to see if there were any Posts to -->
     <!-- display.  This "else" part tells what do if there weren't any. -->
     <p>Sorry, no posts matched your criteria.</p>
     <?php include("/searchform.php");?>
    
     <!-- REALLY stop The Loop. -->
     <?php endif; ?>
    
     <?php wp_reset_query(); // reset the query ?>

    I'd really appreciate some help. Many thanks, Tom

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    First, do not post code longer than about 10 lines; use Pastebin instead, and link to the code.

    Second, we'd need to see your comments.php template file in order to solve your problem.

  3. tjphop
    Member
    Posted 3 years ago #

  4. tjphop
    Member
    Posted 3 years ago #

    I have solved the problem now. Thanks.

  5. kai_h
    Member
    Posted 2 years ago #

    Hi tjphop

    What was it in the end that fixed it?

  6. LiamFos
    Member
    Posted 2 years ago #

    Tjphop

    I would like to know how you fixed this please :)

  7. LiamFos
    Member
    Posted 2 years ago #

    Same error for

    comment-template.php on line 1334

  8. wp-user-487
    Member
    Posted 2 years ago #

    Hi, I am having the same problem on my WP installation. Is there documentation on how to fix it? Many thanks

Topic Closed

This topic has been closed to new replies.

About this Topic