• I have a problem with comments in the WordPress theme I’m building. As of now, I can comment just fine, but whenever I do (press “reply”, “edit comment”, press the date, really anything that involves updating a comment), my header and site content dissapears and I’m stuck with the comment i interacted with at the top of the site/content-wrapper and everything below it (sidebar, footer, other comments that’s below that one).


    Here’s a screenshot of what happens:

    And here’s my comments.php:

    <?php
    /**
     *
     *  Comments themplate - Adapted Version of Kubrick's
     *
     *  There are 2 distinct sections after the protection area ::
     *  Display Comments is a loop surrounding the wp_list_comments() function
     *  The Form/Login section uses comment_form() to do everything
     *  ( Finally the RSS link is at the end of the page )
     *
     *  */
    
    // ##########  Do not delete these lines
    if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])){
    die ('Ikke last denne siden direkte. Takk!'); }
    if ( post_password_required() ) { ?>
    <p class="nocomments"><?php _e('Denne posten er passordbeskyttet. Skriv inn passordet for ? vise kommentarene.', 'kubrick'); ?></p>
    <?php
    return; }
    // ##########  End do not delete section
    
    // Display Comments Section
    if ( have_comments() ) : ?>
    <h3 id="comments"><?php comments_number('Ingen kommentarer', 'én kommentar', '% kommentarer');?> <?php printf('til “%s”', the_title('', '', false)); ?></h3>
        <div class="navigation">
            <div class="alignleft"><?php previous_comments_link() ?></div>
            <div class="alignright"><?php next_comments_link() ?></div>
        </div>
    <ol class="commentlist">
     <?php
     wp_list_comments(array(
      // see https://codex.www.ads-software.com/Function_Reference/wp_list_comments
      // 'login_text'        => 'Login to reply',
      // 'callback'          => null,
      // 'end-callback'      => null,
      // 'type'              => 'all',
      // 'avatar_size'       => 32,
      // 'reverse_top_level' => null,
      // 'reverse_children'  =>
      ));
      ?>
    </ol>
        <div class="navigation">
            <div class="alignleft"><?php previous_comments_link() ?></div>
            <div class="alignright"><?php next_comments_link() ?></div>
        </div>
    <?php
    if ( ! comments_open() ) : // There are comments but comments are now closed
        echo"<p class='nocomments'>Kommentarer er stengt.</p>";
    endif;
    
    else : // I.E. There are no Comments
    if ( comments_open() ) : // Comments are open, but there are none yet
        // echo"<p>Be the first to write a comment.</p>";
    else : // comments are closed
        echo"<p class='nocomments'>Kommentarer er stengt.</p>";
    endif;
    endif;
    
    // Display Form/Login info Section
    // the comment_form() function handles this and can be used without any paramaters simply as "comment_form()"
    comment_form(array(
      // see codex https://codex.www.ads-software.com/Function_Reference/comment_form for default values
      // tutorial here https://blogaliving.com/wordpress-adding-comment_form-theme/
      'comment_field' => '<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4" aria-required="true"></textarea></p>',
      'label_submit' => 'Kommentér',
      'comment_notes_after' => ''
      ));
    
    ?>

    [Bump deleted per https://codex.www.ads-software.com/Forum_Welcome#No_Bumping ]

  • The topic ‘My comments template shoves content away when updating a comment’ is closed to new replies.