Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:21:46+00:00 2026-06-15T21:21:46+00:00

I try to create a WordPress theme and I have several issues. I tryed

  • 0

I try to create a WordPress theme and I have several issues.

I tryed to user the comment_reply_link but didn’t work at all, and I deside to create manualy the link by adding the code following:

<?php
    $permalink = get_permalink() . "?replytocom=" . get_comment_ID() . "#comments-form";
    $onclick = "return addComment.moveForm('comment-" . get_comment_ID() . "', '" . get_comment_ID() . "', 'comments-form', '" . get_the_ID() . "')";
?>
<a href="<?php echo $permalink; ?>" onclick="<?php echo $onclick; ?>">
    <?php _e('Reply', 'z'); ?>
</a>

Also I have enqueue the comment-reply and is loading properly.

My custom made reply link is working properly. The form is moved under my comment when I click the Reply link but after I submit my comment the reply is not placed under the replied comment, but at the end of the comments.

Note : In my comment form I have enter the following code:

<input type='hidden' name='comment_post_ID' value='<?php the_ID(); ?>' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />

and by using the Chrome console, I have see that the field comment_parent value is updated to the replied comment ID

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:21:47+00:00Added an answer on June 15, 2026 at 9:21 pm

    Ok, i really don’t know how can i help you with your particullar problem, but i can give you some guidance for my custom comment template that is working perfect!
    I make my comments template using Ian Stewart tutorial from ThemeShaper http://themeshaper.com/2009/07/01/wordpress-theme-comments-template-tutorial/.
    First, the comments.php file looks like that:

    <?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. -->
    
    <?php if ( have_comments() ) : ?>
        <h3 id="comments"><?php comments_number('No hay Respuestas', 'Hay 1 Respuesta', 'Hay % Respuestas' );?></h3>
    
        <ol class="commentlist">
            <?php wp_list_comments('type=comment&callback=advanced_comment'); //this is the important part that ensures we call our custom comment layout defined above 
                    ?>
        </ol>
        <div class="clear"></div>
        <div class="comment-navigation">
            <div class="older"><?php previous_comments_link() ?></div>
            <div class="newer"><?php next_comments_link() ?></div>
        </div>
     <?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">Los comentarios están cerrados.</p>
    
        <?php endif; ?>
    <?php endif; ?>
    
    
    <?php if ( comments_open() ) : ?>
    
    <div id="respond">
    
    <h3><?php comment_form_title( 'Comentar', 'Responder %s' ); ?></h3>
    
    <div class="cancel-comment-reply">
        <small><?php cancel_comment_reply_link(); ?></small>
    </div>
    
    <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
    <p>Debes iniciar sesión para poder comentar.</p>
    <a href="http://dfine.me?loginGoogle=1&redirect=http://dfine.me" onclick="window.location = 'http://dfine.me?loginGoogle=1&redirect='+window.location.href; return false;"><div class="new-google-btn new-google-3 new-google-default-anim"><div class="new-google-3-1"><div class="new-google-3-1-1">Iniciar Sesión</div></div></div></a>
    <a href="http://dfine.me?loginFacebook=1&redirect=http://dfine.me" onclick="window.location = 'http://dfine.me?loginFacebook=1&redirect='+window.location.href; return false;"><div class="new-fb-btn new-fb-3 new-fb-default-anim"><div class="new-fb-3-1"><div class="new-fb-3-1-1">Iniciar Sesión</div></div></div></a>
    
    <?php else : ?>
    
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php if ( is_user_logged_in() ) : ?>
    
    <p>Sesión iniciada por <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <br><a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Cerrar sesión">Cerrar sesión &raquo;</a></p>
    
    <?php else : //this is where we setup the comment input forums ?>
    
    
    <?php endif; ?>
    
    <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
    
    
    <p><textarea name="comment" id="comment" cols="90%" rows="10" tabindex="4"></textarea></p>
    
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Post" />
    <?php comment_id_fields(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    
    <?php endif; // If registration required and not logged in ?>
    </div>
    
    <?php endif; // if you delete this the sky will fall on your head ?>
    

    I changed the Log In section because i use the Nextend Connect Facebook and Google plugins.
    The Functions in functions.php:

    function advanced_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
    
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
       <div class="comment-author vcard">
         <?php echo get_avatar($comment,$size='90',$default='<path_to_url>' ); ?>
         <small class="comment-date"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></small>     
         <div class="comment-meta"<a href="<?php the_author_meta( 'user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?></a> dice:<?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
         </div>
         <div class="clear"></div>
    
         <?php /*if ($comment->comment_approved == '0') : ?>
           <em><?php _e('Your comment is awaiting moderation.') ?></em>
           <br />
         <?php endif; */?>
    
         <div class="comment-text"> 
             <?php comment_text() ?>
             <div class="reply">
          <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'login_text' => "Responder"))) ?>
           <?php delete_comment_link(get_comment_ID()); ?>
       </div>
         </div>
       <div class="clear"></div>
    <?php }
    

    and this:

    function delete_comment_link($id) {
      if (current_user_can('edit_post')) {
        echo '- <a href="'.admin_url("comment.php?action=cdc&c=$id").'"> Eliminar</a> ';
        echo '- <a href="'.admin_url("comment.php?action=cdc&dt=spam&c=$id").'"> Spam</a>';
      }
    }
    

    Also, i make some minor modifications to the core comment-template.php to add an image next to the ‘Reply’ link. comment-template.php:

    if ( get_option('comment_registration') && !$user_ID )
            $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '"><img src="' . $direccion_sitio . '/images/reply.png" alt="Responder" style="margin-right:5px;">' . $login_text . '</a>';
        else
            $link = "<a class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'><img src='" . $direccion_sitio . "/images/reply.png' alt='Responder' style='margin-right:5px;'>$reply_text</a>";
        return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
    

    And finally, the CSS!

    /*Comentarios*/
    .comments-template{
        width: 730px;
        display: inline-block;
        margin: 10px 0;
        padding-top: 20px;
        border-top: 3px dotted #CCC;
    }
    
    #comments{
        padding-bottom: 10px;
        border-bottom: 1px solid #EEE;
    }
    
    .commentlist{
        margin: 15px 0;
    }
    
    .comment-meta{
        padding: 5px 10px 1px 0;
        border-bottom: 1px dashed lightGrey;
        margin-bottom: 5px;
        display: inline-block;
    }
    
    .comment-meta .url{
        font-family: 'Franklin Gothic Book Italic', sans-serif;
        font-size: 1.1em;
        font-weight: 700;
    }
    
    .comment-text{
        padding: 5px 0 35px 0;
        min-height: 65px;
        position: relative;
        border-bottom: 1px solid #EEE;
        margin-bottom: 10px;
    }
    .comment-date{
        display: block;
        padding-top: 5px;
        font-size: 0.7em;
        color: #7E7E7E;
        font-style: italic; 
    }
    .comments-template .avatar-90{
        float: left;
        padding: 5px 15px 10px 0;
    }
    .reply{
        position: absolute;
        bottom: 10px;
        right: 10px;
    }
    .depth-2{
        margin-left: 105px;
    }
    .depth-3{
        margin-left: 210px;
    }
    #respond{
        margin-bottom: 30px;    
    }
    /*Fin Comentarios*/
    

    If i get it right, your main problem is the Answer for a particular comment is not showing properly, so maybe you need to look at your CSS for the, in my case, .depth classes.

    If you want to test my custom comments template you can visit http://dfine.me and comment anything in any post. My configuration in the WordPress preferences is to allow only 1 nested comment.
    Hope this helps!
    PS: Sorry for the mixed ‘English-Spanish’ statements…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create a theme in WordPress, and allow the user for some
I create (or better try) to create my first WordPress theme with Less. What
I try to create a theme. In that theme I have create a custom
I'm trying to create a WordPress site from the gallery, but I don't have
I'll try create a controler in towerjs, but I have an error while updating
I try create a map for open ~/.vimrc, but open the ~/.vimrc only when
I try to create styles with first-child and last-child items but I encountered a
I try to create the simplest WinAPI window using assembly NASM. I have problem
I have a wordpress theme with an options page. I have included a basic
I have a client that has multiple Wordpress installations, which he didn't keep up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.