• Not sure if this goes here but, this is my problem.
    posted this on the CodeGrrl forums and the TFL boards, but maybe someone here can help me…

    I copied and pasted this code into my comments.php file:

    <ol class="commentlist">
    <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
    </ol>

    This into my functions.php file:

    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    
             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?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 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('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php

    And now I have errors here https://paintedmemories.pixelfx.org/2009/07…-bust/#comments

    This is what my comments.php file looks like:

    <?php
    /**
    * @package WordPress
    * @subpackage Default_Theme
    */
    
    // Do not delete these lines
        if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
            die ('Please do not load this page directly. Thanks!');
    
        if ( post_password_required() ) { ?>
            <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
        <?php
            return;
        }
    ?>
    
    <!-- You can start editing here. -->
    <p></p>
    <?php if ( have_comments() ) : ?>
    <h3 id="comments"><?php comments_number('No Comments', 'One Comment', '% Comments' );?> on <u><?php the_title(); ?></u></h3>
    <br />
    <ol class="commentlist">
    <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
    </ol>
    
    <?php if(function_exists('wp_commentnavi')) { wp_commentnavi(); } ?>
    <br />
    
    <?php else : // this is displayed if there are no comments so far ?>
    
    <?php if ( comments_open() ) : ?>
    <!-- If comments are open, but there are no comments. -->
    
    <?php else : // comments are closed ?>
    <!-- If comments are closed. -->
    <p class="nocomments">Comments are closed.</p>
    
    <?php endif; ?>
    <?php endif; ?>
    
    <?php if ( comments_open() ) : ?>
    
    <div id="respond">
    
    <h1><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h1>
    <div class="sidebox">
    <div class="cancel-comment-reply">
    <small><?php cancel_comment_reply_link(); ?></small>
    </div>
    <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
    <p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>
    
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php if ( is_user_logged_in() ) : ?>
    
    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out ?</a></p>
    
    <?php else : ?>
    
    <p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="35" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
    
    <p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="35" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
    
    <p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="35" tabindex="3" />
    <label for="url"><small>Website</small></label></p>
    
    <?php
    /****** Math Comment Spam Protection Plugin ******/
    if ( function_exists('math_comment_spam_protection') ) {
        $mcsp_info = math_comment_spam_protection();
    ?>     <p><input type="text" name="mcspvalue" id="mcspvalue" value="" size="35" tabindex="4" />
        <label for="mcspvalue"><small>Spam protection: Sum of <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?></small></label>
        <input type="hidden" name="mcspinfo" value="<?php echo $mcsp_info['result']; ?>" />
    </p>
    <?php } // if function_exists... ?>
    
    <?php endif; ?>
    
    <?php if ( function_exists(cs_print_smilies) ) {cs_print_smilies();} ?>
    
    <p><?php live_preview() ?></p>
    
    <p><textarea name="comment" id="comment" cols="75%" rows="10" tabindex="4"></textarea></p>
    
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    <?php comment_id_fields(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    </div><!-- END SIDEBOX-->
    
    <?php endif; // If registration required and not logged in ?>
    </div>
    
    <?php endif; // if you delete this the sky will fall on your head ?>

    And this is what my function.php file looks like:

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
            'before_title' => '',
            'after_title' => '',
        ));
    ?>
    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    
             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?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 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('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php

    I’m pretty sure I don’t need the wigit coding, but I don’t want to mess with it and make the errors worse. If some can help me, that would be great.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP comments’ is closed to new replies.