• Author
    Posts
  • #73799

    thescubadude
    Participant

    When comments are off this div is still written to the page:
    <div id=”comments” class=”comments-area”>

    This creates extra padding/margins above the footer with a thin grey line. See attached screenshot.

    If I edit the comments template by moving the div then it resolves the is but not sure how it impacts other stuff and also don;t really want to be editing your core theme files. I would prefer to be only working on my own customisations.

    So in comments.php if I take this code.

    if ( post_password_required() ) {
    return;
    }
    ?>

    <div id=”comments” class=”comments-area”>

    <?php // You can start editing here — including this comment! ?>

    <?php if ( have_comments() ) : ?>

    and move the div and the closing div towards the end this is resolved.

    if ( post_password_required() ) {
    return;
    }
    ?>

    <?php // You can start editing here — including this comment! ?>

    <?php if ( have_comments() ) : ?>

    <div id=”comments” class=”comments-area”>

  • #73801

    thescubadude
    Participant

    The above change obviously breaks things when the comments are actually on but there have been no comments.

  • #73858

    Hien (CMS help)
    Moderator

    Hi,
    I see that: Paragraph code alternative above is incorrect.
    Because it lost tag </div>

    Thank you!

  • #74422

    thescubadude
    Participant

    Yes I am aware of moving the closing div.

    The issue I have is that when comments are turned off the theme still shows the line with the border and padding between the last elements and the footer because of your code.

    If I move the div as above including moving the closing div then the grey line and margins do not show when comments are turned off but it also doesn’t show when comments are on unless there are comments.

  • #74577

    Hien (CMS help)
    Moderator

    hello,
    You can set up a new row in this location then insert color background and set up margin top for it.

    Thank you!

  • #74918

    thescubadude
    Participant

    Seem to be a lot of bugs. After going through your code and functions I have realised you are not testing if comments are open anywhere only testing if there are comments.

    I have now wrapped your comments.php page in my child theme in a test for comments being open. Which resolves the issues I have been experiencing.

    So…

    <?php
    /**
    * The template for displaying Comments.
    *
    * The area of the page that contains both current comments
    * and the comment form.
    *
    * @package cshero
    */

    /*
    * 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;
    }

    if (comments_open( $post_id )) {
    ?>

    <div id=”comments” class=”comments-area”>

    <?php // You can start editing here — including this comment! ?>

    <?php if ( have_comments() ) : ?>

    <h3 class=”comments-title”>
    <span>Comment</span>
    </h3>

    <?php if ( get_comment_pages_count() > 1 && get_option( ‘page_comments’ ) ) : // are there comments to navigate through ?>
    <nav id=”comment-nav-above” class=”comment-navigation col-xs-12 col-sm-12 col-md-12 col-lg-12″ role=”navigation”>
    <h1 class=”screen-reader-text”><?php _e( ‘Comment navigation’, ‘organicfood’ ); ?></h1>
    <div class=”nav-previous”><?php previous_comments_link( __( ‘← Older Comments’, ‘organicfood’ ) ); ?></div>
    <div class=”nav-next”><?php next_comments_link( __( ‘Newer Comments →’, ‘organicfood’ ) ); ?></div>
    </nav><!– #comment-nav-above –>
    <?php endif; // check for comment navigation ?>

      <?php
      wp_list_comments( array(
      ‘style’ => ‘ol’,
      ‘short_ping’ => true,
      ) );
      ?>

    <!– .comment-list –>

    <?php if ( get_comment_pages_count() > 1 && get_option( ‘page_comments’ ) ) : // are there comments to navigate through ?>
    <nav id=”comment-nav-below” class=”comment-navigation” role=”navigation”>
    <h1 class=”screen-reader-text”><?php _e( ‘Comment navigation’, ‘organicfood’ ); ?></h1>
    <div class=”nav-previous”><?php previous_comments_link( __( ‘← Older Comments’, ‘organicfood’ ) ); ?></div>
    <div class=”nav-next”><?php next_comments_link( __( ‘Newer Comments →’, ‘organicfood’ ) ); ?></div>
    </nav><!– #comment-nav-below –>
    <?php endif; // check for comment navigation ?>

    <?php endif; // have_comments() ?>

    <?php
    // If comments are closed and there are comments, let’s leave a little note, shall we?
    if ( ! comments_open() && ‘0’ != get_comments_number() && post_type_supports( get_post_type(), ‘comments’ ) ) :
    ?>
    <p class=”no-comments”><?php _e( ‘Comments are closed.’, ‘organicfood’ ); ?></p>
    <?php endif; ?>

    <?php comment_form(); ?>
    </div><!– #comments –>
    <?php
    }

  • #75275

    Hien (CMS help)
    Moderator

    Hi,
    Ok. Thanks for your contribution.
    We will update this function in the next version
    Thank you!

You must be logged in to reply to this topic. You can click here