• I would like to set the comment form just before my posts, not behind the comments. But I don’t know how to do it.

    Thanks.
    Almudena.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author TT Themes

    (@tomastoman)

    Dear Almudena,

    if you have too many comments on your posts so their list is too long, I can recommend you to go to “Settings > Discussion” panel in your WordPress administration and check here the option “Break comments into pages”. This option breaks your comments into more pages.

    Most themes display the comment form just under the list of comments. If you would like to move it before the comments, you will need to edit the “comments.php” theme file in the following way (simply replace the whole current content of the “comments.php” file by the following code):

    <?php
    /**
     * The template for displaying Comments.
     * @package PaperCuts
     * @since PaperCuts 1.0.0
    */
    if ( post_password_required() )
    	return;
    ?>
    <?php global $papercuts_options_db; ?>
    <div id="comments" class="comments-area<?php if ( $papercuts_options_db['papercuts_next_preview_post'] == '' || $papercuts_options_db['papercuts_next_preview_post'] == 'Display' ) { ?> comments-area-post<?php } ?>">
    
    	<?php $placeholder_name = __( 'Your name' , 'papercuts' );
       $placeholder_web = __( 'Website' , 'papercuts' );
       $placeholder_comment = __( 'Comment...' , 'papercuts' );
       $aria_req = ( $req ? " aria-required='true'" : '' );
       $field_req = ( $req ? " *" : '' );
       $comment_args = array(
    'title_reply'=>__( 'Leave a Comment' , 'papercuts' ),
    'fields' => apply_filters( 'comment_form_default_fields', array(
    'author' => '<p class="comment-form-author">' . '<label for="author">' . __( '', 'papercuts' ) . '</label> ' . '<input id="author" name="author" type="text" placeholder="' . $placeholder_name . $field_req . '" value=""  size="30"' . $aria_req . ' /></p>',
    'email'  => '<p class="comment-form-email">' .
    '<label for="email">' . __( '', 'papercuts' ) . '</label> ' .
    '<input id="email" name="email" type="text" placeholder="E-mail' . $field_req .'" value="" size="30"' . $aria_req . ' />'.'</p>',
    'url'    => '<p class="comment-form-url">' .
    '<label for="url">' . __( '', 'papercuts' ) . '</label> ' .
    '<input id="url" name="url" type="text" placeholder="' . $placeholder_web . '" value="" size="30" />'.'</p>' ) ),
    'comment_field' => '<p>' .
    '<label for="comment">' . __( '', 'papercuts' ) . '</label>' .
    '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder="' . $placeholder_comment . '"></textarea>' .
    '</p>',);
    comment_form($comment_args); ?>
    
    	<?php if ( have_comments() ) : ?>
        <h2 class="entry-headline"><?php printf( _n( '1 Comment', '%1$s Comments', get_comments_number(), 'papercuts' ), number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); ?></h2> 
    
    		<ol class="commentlist">
    			<?php wp_list_comments( array( 'callback' => 'papercuts_comment', 'style' => 'ol' ) ); ?>
    		</ol><!-- .commentlist -->
    
    		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
    		<div id="comment-nav-below" class="navigation" role="navigation">
    			<div class="nav-wrapper">
          <p class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'papercuts' ) ); ?> </p>
    			<p class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'papercuts' ) ); ?></p>
          </div>
    		</div>
    		<?php endif; ?>
    
    		<?php if ( ! comments_open() && get_comments_number() ) : ?>
    		<p class="nocomments"><?php _e( 'Comments are closed.' , 'papercuts' ); ?></p>
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    </div><!-- #comments .comments-area -->

    I hope that my answer will be helpful for you.

    Best regards
    Tomas Toman

    Thread Starter Almudenita11

    (@almudenita11)

    I have done these, but now my former comments become with this error!!!

    Warning: call_user_func() expects parameter 1 to be a valid callback, function ‘papercuts_comment’ not found or invalid function name in W:\vhosts\blogdeluis.com\httpdocs\wp-includes\comment-template.php on line 1694

    Thread Starter Almudenita11

    (@almudenita11)

    I have done these, but now my former comments become with this error!!!

    Warning: call_user_func() expects parameter 1 to be a valid callback, function ‘papercuts_comment’ not found or invalid function name in W:\vhosts\blogdeluis.com\httpdocs\wp-includes\comment-template.php on line 1694

    Theme Author TT Themes

    (@tomastoman)

    Dear Almudena,

    I have tested the modified code with the clear WordPress installation and everything seems to be OK. Please verify that you have replaced the whole content of “comments.php”. Also check if there are no empty lines at the start and end of this file. Of course, the code posted above will work only with PaperCuts theme, not with any other themes.

    You can edit the “comments.php” file through “Appearance > Editor” panel. If your problems continue, please post here a link to your website (if possible).

    Best regards
    Tomas Toman

    Theme Author TT Themes

    (@tomastoman)

    According to your error message, I expect that your website URL is http://blogdeluis.com/. If so, it seems that you are not using the PaperCuts theme so my code posted above can’t work with it. If I display the source code of your website, I can see that your theme name is Papercut, not PaperCuts, so it is a different theme. I have checked the WordPress repository and there is no theme called Papercut. It seems that your theme comes from another source than wordpress.org.

    Best regards
    Tomas Toman

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Comments position’ is closed to new replies.