I try to generate nested reply with my custom layout but its showing nested comments as a new comment ...

here is my comment.php code

<?php
/**
 * The template for displaying Comments.
 *
 * The area of the page that contains comments and the comment form.
/*
 * If the current post is protected by a password and the visitor has not yet
 * entered the password we will return early without loading the comments.
 */

if (post_password_required())
return;
?>
<div class="left">
<?php
global $post;
$number_of_comments = wp_count_comments($post->ID);
comments_number('0 Replies', 'One Reply', "$number_of_comments->approved Replies");
?>  
</div>

<?php
$args = array(
'walker'            => null,
'max_depth'         => '5',
'style'             => '',
'callback'          => mytheme_comment,
'end-callback'      => null,
'type'              => 'all',
'reply_text'        => 'Reply Thread',
'page'              => '',
'per_page'          => '',
'avatar_size'       => 32,
'reverse_top_level' => null,
'reverse_children'  => '',
'format'            => 'xhtml', //or html5 @since 3.6
'short_ping'        => false // @since 3.6
);
wp_list_comments($args);
?>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<?php
if (is_user_logged_in())
{
echo "<div class='left comment-box'>";
?>
<?php if (comments_open()) : ?> 

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">  
    <?php if ($user_ID) : ?>  
            <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out &raquo;</a></p>  

            <input name="submit" type="submit" id="submit" tabindex="5" value="Reply" class="comment-reply"/>  <br>
            <input name="postto" id="postto" value="1" type="checkbox"/> Post To Profile<br>
    <?php endif; ?>  
        <?php wp_editor('', 'comment', $settings = array('media_buttons' => true, 'textarea_rows' => 10)); ?>


        <input type="hidden" name="comment_post_ID" value="<?php the_ID() ?>" /></p>  
    <?php do_action('comment_form', $post->ID); ?>  
    </form>  

<?php else : ?>  
    <p>The comments are closed.</p>  
<?php endif; ?>  

<?php
echo "</div>";
}else
{
?>
<div class="post-thread">
    <center>
        <div class="sfbutton">
            <a href="#" onclick=' fb_login("<?php echo get_permalink($post->ID) ?>");'></a>
        </div>
    </center>
</div>
<?php
}?>

and here is my call back function

function mytheme_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ('div' == $args['style'])
{
    $tag = 'div';
    $add_below = 'comment';
}
else
{
    $tag = 'li';
    $add_below = 'div-comment';
}
$comment_user = get_userdata($comment->user_id);
?>

<section class='post-thread' id="comment-<?php comment_ID(); ?>">
    <div class="thread-post-detail">
        <div class="thread-user-pic">
<?php
echo "<img class='img-responsive' src='" . get_picture($comment->comment_author, 75) . "' />"
?>
        </div>
        <div class="thread-user-info">
            <a href="<?php echo site_url() . "/author/" . $comment_user->user_login ?>">
                <div class='thread_user_name'><strong><?php echo ucfirst($comment_user->first_name); ?></strong></div>
                <div class='thread_user_name'><strong><?php echo ucfirst($comment_user->last_name); ?></strong></div>
            </a>
            <div class="user-join-date">Joined <?php
                $join_date_time = $comment_user->user_registered;
                $join_date = new DateTime($join_date_time);

                echo $join_date = $join_date->format('m.d.y');
                ?>
            </div>
            <div class="sfpuserreply">
                <div class="sfpicon-text left fblikelogo">Likes</div>
                <div class="user-social-count left "><?php
                    if ($userlikes = get_user_meta($comment_user->ID, 'sfp_user_like_count'))
                        echo $userlikes[0];
                    else
                        echo 0;
                    ?>
                </div>
            </div>
            <div class="sfpuserreply">
                <div class="sfpicon-text left fbsharelogo">Share</div>
                <div class="user-social-count left">
                    <?php
                    if ($usershare = get_user_meta($comment_user->ID, 'sfp_user_fb_share'))
                        echo $usershare[0];
                    else
                        echo 0;
                    ?>
                </div>
            </div>
            <div class="sfpuserreply">
                <div class="sfpicon-text left">Replies</div>
                <div class="user-social-count left"><?php
                    $comments = get_comments('user_id=' . $comment_user->ID);
                    echo count($comments);
                    ?></div>
            </div>
        </div>
    </div>
    <div class="thread-post-content">
        <div class="thread-posted">Posted 
        <?php
        $post_time_date = $comment->comment_date;
        $post_time_date = new DateTime($post_time_date);
        echo $post_time_date->format('d.m.Y') . " @ " . $post_time_date->format('H:i A');
        ?>
        </div>
        <?php
//                var_dump($comment);
        if ($comment->comment_approved == '0') :
            ?>  
            <p>Your comment is awaiting approval</p>  
            <?php endif; ?> 
        <div class="thread_single_content"><?php echo nl2br($comment->comment_content); ?></div>
    </div>
    <div class="comment-reply-data">
        <div class="reply">
<?php
comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'])));
if (isset($_REQUEST['replytocom']) && $_REQUEST['replytocom'] == $comment->comment_ID)
{
    ?>
                <div id="respond">
                    <form id="commentform" method="post" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php">



                       <textarea tabindex="5" rows="10" cols="100%" id="comment" name="comment"></textarea>

                        <button tabindex="6" id="submit" type="submit" name="submit">Submit Your Comment</button>
                            <?php do_action('comment_form', $post->ID); ?>
                            <input type="hidden" value="<?php echo $comment->comment_ID ?>" id="comment_parent" name="comment_parent">
                         <input type="hidden" name="comment_post_ID" value="<?php the_ID() ?>" />


                    </form>
                </div>
    <?php
    cancel_comment_reply_link('Cancel Reply');
}

?>
        </div>

    </div>


    <?php if (current_user_can('manage_options'))
    {
        ?>

        <div class="sfp-edit-msg"><a href="<?php echo admin_url() . 'comment.php?action=editcomment&c=' . $comment->comment_ID ?>">Edit</a></div>
        <div class="sfp-delete-msg"><a href="<?php echo site_url() . '/?sfp_action=comment_delete&cid=' . $comment->comment_ID; ?>">Delete</a></div> <?php
}
else
{
    ?>
        <div class="report-message"><a href='<?php echo site_url() . "/?sfp_action=comment_report&errmsgid=" . $comment->comment_ID ?>'>Report Message</a></div>
<?php } ?>
</section>
<?php
}

and i used wp_editor for comment with media upload ... Please help me out , what i did wrong , i'm newbie with WordPress theme customization

Member Avatar for LastMitch

and i used wp_editor for comment with media upload ... Please help me out , what i did wrong , i'm newbie with WordPress theme customization

@pawan768

So you are modifying a wordpress plugin to suit your own code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.