This is my first foray into customizing the WP comment form, and it's giving me a bit of trouble. Ideally, I'd like to have a comment form with 3 fields: Name, Location, and Comment. To facilitate that, I'm using arrays:

<?php comment_form(array(
    'title_reply'=> 'Please feel free to share your home owning hopes and dreams.',
    'fields' => apply_filters( 'comment_form_default_fields', $fields ),
    'label_submit' => 'Share',
    )); 
    ?>

In the comment list, I want the comment to display and just below that have "Name | Location"

<div class="comment-content"><?php comment_text(); ?><?php comment_author(); ?> | <?php echo $comment_author_url ?> </div>

As you can see on the live site, it isn't quite coming out that way. Any ideas why that may be? Tips and insight are appreciated.

functions.php

<?php 

if ( ! function_exists( 'twentyeleven_comment' ) ) :
/**
 * Template for comments and pingbacks.
 *
 * To override this walker in a child theme without modifying the comments template
 * simply create your own twentyeleven_comment(), and that function will be used instead.
 *
 * Used as a callback by wp_list_comments() for displaying the comments.
 *
 * @since Twenty Eleven 1.0
 */
function twentyeleven_comment( $comment, $args, $depth ) {
    $GLOBALS['comment'] = $comment;
    switch ( $comment->comment_type ) :
        case 'pingback' :
        case 'trackback' :
    ?>
    <li class="post pingback">
        <p><?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?></p>
    <?php
            break;
        default :
    ?>
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
        <article id="comment-<?php comment_ID(); ?>" class="comment">

            <div class="comment-content"><?php comment_text(); ?><?php comment_author(); ?> | <?php echo $comment_author_url ?> </div>

        </article><!-- #comment-## -->

    <?php
            break;
    endswitch;
}
endif; // ends check for twentyeleven_comment()

// Custom callback to list comments in the your-theme style
function custom_comments($comment, $args, $depth) {
  $GLOBALS['comment'] = $comment;
    $GLOBALS['comment_depth'] = $depth;
  ?>
    <li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
        <div class="comment-author vcard"><?php commenter_link() ?></div>
        <div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'your-theme'),
                    get_comment_date(),
                    get_comment_time(),
                    '#comment-' . get_comment_ID() );
                    edit_comment_link(__('Edit', 'your-theme'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
  <?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'your-theme') ?>
          <div class="comment-content">
            <?php comment_text() ?>
        </div>
        <?php // echo the comment reply link
            if($args['type'] == 'all' || get_comment_type() == 'comment') :
                comment_reply_link(array_merge($args, array(
                    'reply_text' => __('Reply','your-theme'),
                    'login_text' => __('Log in to reply.','your-theme'),
                    'depth' => $depth,
                    'before' => '<div class="comment-reply-link">',
                    'after' => '</div>'
                )));
            endif;
        ?>
<?php } // end custom_comments

// Custom callback to list pings
function custom_pings($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment;
        ?>
            <li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
                <div class="comment-author"><?php printf(__('By %1$s on %2$s at %3$s', 'your-theme'),
                        get_comment_author_link(),
                        get_comment_date(),
                        get_comment_time() );
                        ?></div>
    <?php if ($comment->comment_approved == '0') _e('\t\t\t\t\t<span class="unapproved">Your trackback is awaiting moderation.</span>\n', 'your-theme') ?>
            <div class="comment-content">
                <?php comment_text() ?>
            </div>
<?php } // end custom_pings

// Produces an avatar image with the hCard-compliant photo class
function commenter_link() {
    $commenter = get_comment_author_link();
    if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) {
        $commenter = ereg_replace( '(<a[^>]* class=[\'"]?)', '\\1url ' , $commenter );
    } else {
        $commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter );
    }
    $avatar_email = get_comment_author_email();
    $avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, 80 ) );
    echo $avatar . ' <span class="fn n">' . $commenter . '</span>';
} // end commenter_link

if (!function_exists('iweb_reverse_comments')) {
    function iweb_reverse_comments($comments) {
        return array_reverse($comments);
    }
}
add_filter ('comments_array', 'iweb_reverse_comments');

// custom comment field
function my_fields($fields) {
$fields['Location'] = '';
return $fields;
}
add_filter('comment_form_default_fields','my_fields');

?>

share.php

<?php
/*
Template Name: Share
*/
?>

<?php get_header(); ?>

<div class="content-left">

    <?php comments_template(); ?> 

</div><!-- end content-left -->
<div class="content-right">

    <?php wp_list_comments( array( 'callback' => 'twentyeleven_comment' )); ?></ul>

</div><!-- end content-right -->

<?php get_footer(); ?>
share|improve this question
feedback

1 Answer

i don't think it's twentyeleven_comment that you have to edit. try an echo in the twentyeleven_comment to see if it's the right function.

echo "twentyeleven_comment ";
exit;

i think twentyeleven_comment show all comments of a post in the post view not the post list.

share|improve this answer
I'm sorry, as I mentioned I'm still very new to this. I searched through php.net and didn't find much direction on how to echo.exit. Can you provide an example? Thank you. – AMC Oct 17 '12 at 3:35
i was triying to help you not to mock you, anyways good luck. – mbouzahir Oct 17 '12 at 3:43
Yes, I know you were trying to help! And thank you. I was simply seeing if you might be able to explain a bit more in depth. – AMC Oct 17 '12 at 4:16
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.