• Resolved David_G

    (@questas_admin)


    On post comments the order in which the posts and post comments show is:

    1: POST
    2: LEAVE A COMMENT
    3: COMMENTS

    I would like to change that to:

    1: POST
    2: COMMENTS
    3: LEAVE A COMMENT

    Is this possible without resorting to a forum?

Viewing 5 replies - 1 through 5 (of 5 total)
  • In your child theme, create a file called comments.php with the following content:

    <?php
    /**
     * The template for displaying comments in a Customizr child theme.
     * Modified to show the comments before the comment form.
     */
    ?>
    <?php if ( have_comments() ) : ?>
    
    	<?php echo apply_filters( 'comment_separator', '<hr class="featurette-divider '.current_filter().'">' ); ?>
    
    <?php endif; ?>
    
    <div id="comments" class="comments-area">
    
    	<?php if ( have_comments() ) : ?>
    
    		<?php do_action ( '__comment' );?>
    
    	<?php endif; // have_comments() ?>
    
    	<?php
    	$args = array(
    	  'title_reply'       => __( 'Leave a Comment' , 'customizr' ),
    	);
    
    	comment_form($args); 
    
    	?>
    
    </div><!-- #comments .comments-area -->

    This is a copy of the theme’s comments.php, with re-ordering of the comments/form. It will take precedence over the parent theme’s file.

    Thread Starter David_G

    (@questas_admin)

    Thanks a million ElectricFeet, that works perfectly.
    I tried to compare this with the original comments.php file to see how it changed the order, but got lost. The WP comments.php file is totally different not to mention much larger.

    It’s Customizr’s comments.php that you’re overriding, not WordPress’s. It’s in the main folder of the Customizr theme (in wp-content/themes/customizr).

    I simply shifted this:

    <?php if ( have_comments() ) : ?>
    
    		<?php do_action ( '__comment' );?>
    
    	<?php endif; // have_comments() ?>

    above this:

    <?php
    	$args = array(
    	  'title_reply'       => __( 'Leave a Comment' , 'customizr' ),
    	);
    
    	comment_form($args); 
    
    	?>

    rather than below it.

    Thread Starter David_G

    (@questas_admin)

    I think I understand, I will now re-examine WP’s comments.php file.

    Thanks for explaining how this worked.

    I will now re-examine WP’s comments.php

    You don’t need to. It’s Customizr’s comments.php that I got the code from.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Is there any way to’ is closed to new replies.